Local authentication can be successful but remote authentication failed

I met a problem:local authentication can be successful but remote authentication failed,

my mongo version is 4.2.2 ,

the mongodb is single shard and it has run more than 3 months without any problem until today I connect from another machine using mongo shell such as :

mongo --host x.x.x.x --port 27017 -u "myuser" --authenticationDatabase "mydb" -p 

and it output following error:

MongoDB shell version v4.2.2

connecting to: mongodb://x.x.x.x:27017/admin?authSource=admin&compressors=disabled&gssapiServiceName=mongodb

2020-02-16T14:05:50.384+0800 E  QUERY    [js] Error: Authentication failed. :

connect@src/mongo/shell/mongo.js:341:17

@(connect):2:6

2020-02-16T14:05:50.386+0800 F  -        [main] exception: connect failed

2020-02-16T14:05:50.386+0800 E  -        [main] exiting with code 1

and the maxsize datafile of the collection is 180GB(only one file is 180G):

[root@mongo mongo]# ls -lh collection-11-6825888606219797635.wt

-rw-------. 1 mongod mongod 180G 2月  15 18:19 collection-11-6825888606219797635.wt

all the other factors is not changed,such as firewall is disabled,bindip is 0.0.0.0 the password is absolutely right,and even plus --authenticationMechanism also considered

the unique changed factor is the data is increased day by day ,so I guess it is related to the huge file size but I am not sure.please help me many thanks.

Hi @1111,

Have you checked the remaning size on the disk?

I had a similar issue in the past and what has helped me out was clearing out some space and trying it again. Or you can increase the disk size and check.

Let me know if it works for you the same way.

in your command line options, authenticationDatabase is “mydb”, but the shell output lists authSource as admin. Are you sure you are authenticating against the right database?