List Users in Self-Managed Deployments
To list all users, use mongosh
to query the
system.users collection:
시작하기 전에
MongoDB 8.0 부터는 directShardOperations
역할 을 사용하여 샤드 에 대해 직접 명령을 실행해야 하는 유지 관리 작업을 수행할 수 있습니다.
경고
directShardOperations
역할 을 사용하여 명령을 실행하면 클러스터 가 올바르게 작동하지 않고 데이터가 손상될 수 있습니다. directShardOperations
역할 은 유지 관리 목적으로만 사용하거나 MongoDB 지원 의 지침 에 따라 사용하세요. 유지 관리 작업 수행이 완료되면 directShardOperations
역할 사용을 중지합니다.
단계
use admin db.system.users.find()
중요
Do not modify the system.users collection directly. To manage users, use the designated user management commands.
To list all users of a 샤딩된 클러스터 that were
created through a mongos
, connect to a
mongos
and run the preceding command. MongoDB stores
users that are created through a mongos
in the admin
database of the config servers.
To list all shard local users, connect to the respective shard directly and run
the preceding command. MongoDB stores shard local users in the
admin
database of the shard itself. These shard local users are
independent from the users added to the sharded cluster through a
mongos
. Shard local users are local to the shard and
are inaccessible to mongos
.