M040 Chap 6 Mongosqld - unable to initialize schema: no servers available: server selection failed

I am able to connect to each of the replicated nodes via Compass.

However, I am unable to get past this mongosqld error:

vagrant@m040:~$ mongosqld --addr 192.168.40.100:3307 --mongo-uri mongodb://192.168.40.100:27017,192.168.40.100:27027,192.168.40.100:27037/?replicaSet=m040
2019-03-17T03:35:54.479+0000 I CONTROL [initandlisten] mongosqld starting: version=v2.5.0 pid=2601 host=m040
2019-03-17T03:35:54.479+0000 I CONTROL [initandlisten] git version: 301aa3f46c15c0640af446283317798e797abdb3
2019-03-17T03:35:54.479+0000 I CONTROL [initandlisten] OpenSSL version OpenSSL 1.0.1f 6 Jan 2014 (built with OpenSSL 1.0.1f 6 Jan 2014)
2019-03-17T03:35:54.479+0000 I CONTROL [initandlisten] options: {net: {bindIp: [192.168.40.100]}, mongodb: {net: {uri: “mongodb://192.168.40.100:27017,192.168.40.100:27027,192.168.40.100:27037/?replicaSet=m040”}}}
2019-03-17T03:35:54.479+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for mongosqld.
2019-03-17T03:35:54.479+0000 I CONTROL [initandlisten]
2019-03-17T03:35:54.482+0000 I NETWORK [initandlisten] waiting for connections at 192.168.40.100:3307
2019-03-17T03:35:54.482+0000 I NETWORK [initandlisten] waiting for connections at /tmp/mysql.sock
2019-03-17T03:35:54.482+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T03:35:59.483+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T03:36:04.483+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T03:36:09.483+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T03:36:14.484+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T03:36:19.485+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T03:36:24.485+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T03:36:29.487+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T03:36:34.489+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T03:36:39.490+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T03:36:44.491+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T03:36:49.493+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T03:36:54.493+0000 I SAMPLER [schemaDiscovery] initializing schema
^C2019-03-17T03:36:57.281+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context canceled
2019-03-17T03:36:57.281+0000 I CONTROL [signalProcessingThread] shutting down

vagrant@m040:~$ mongosqld --addr 192.168.40.100:3307 --mongo-uri mongodb://localhost:27017,localhost:27027,localhost:27037/?replicaSet=m040

2019-03-17T00:11:36.138+0000 I CONTROL [initandlisten] mongosqld starting: version=v2.5.0 pid=2055 host=m040
2019-03-17T00:11:36.138+0000 I CONTROL [initandlisten] git version: 301aa3f46c15c0640af446283317798e797abdb3
2019-03-17T00:11:36.138+0000 I CONTROL [initandlisten] OpenSSL version OpenSSL 1.0.1f 6 Jan 2014 (built with OpenSSL 1.0.1f 6 Jan 2014)
2019-03-17T00:11:36.138+0000 I CONTROL [initandlisten] options: {net: {bindIp: [192.168.40.100]}, mongodb: {net: {uri: “mongodb://localhost:27017,localhost:27027,localhost:27037/?replicaSet=m040”}}}
2019-03-17T00:11:36.138+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for mongosqld.
2019-03-17T00:11:36.138+0000 I CONTROL [initandlisten]
2019-03-17T00:11:36.140+0000 I NETWORK [initandlisten] waiting for connections at 192.168.40.100:3307
2019-03-17T00:11:36.140+0000 I NETWORK [initandlisten] waiting for connections at /tmp/mysql.sock
2019-03-17T00:11:36.140+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:11:41.140+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:11:46.141+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:11:51.143+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:11:56.143+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:12:01.145+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:12:06.152+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:12:11.158+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:12:16.159+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:12:21.162+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:12:26.163+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:12:31.165+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:12:36.167+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:12:41.168+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
2019-03-17T00:12:46.169+0000 I SAMPLER [schemaDiscovery] initializing schema
2019-03-17T00:12:51.171+0000 E SAMPLER [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded
^C2019-03-17T00:12:52.541+0000 I CONTROL [signalProcessingThread] shutting down

Are the corresponding mongod running?

I can connect to each node via compass? Am I misunderstanding?

I asked because the error indicates no servers available.

Can you run “ss -tln” and “ps -aef | grep mongod | grep -v grep”?

vagrant@m040:~ ss -tln State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:27027 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 *:27037 *:* LISTEN 0 128 *:33701 *:* LISTEN 0 128 *:27017 *:* LISTEN 0 128 :::111 :::* LISTEN 0 128 :::22 :::* LISTEN 0 128 :::38602 :::* vagrant@m040:~ Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
vagrant-env billBill$ ps -aef | grep mongod | grep -v grep
vagrant-env billBill$ ps -aef | grep mongod
502 1289 886 0 10:42AM ttys000 0:00.01 grep mongod

You have to stay in the vagrant VM. That’s where mongod is running. When you provide terminal output or text file content please enclose in the pre or code html tag.

Oops. below is within VM. Not sure what you mean by enclose in the pre or code html tag.

vagrant@m040:~ ss -tln State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:27027 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 *:27037 *:* LISTEN 0 128 *:33701 *:* LISTEN 0 128 *:27017 *:* LISTEN 0 128 :::111 :::* LISTEN 0 128 :::22 :::* LISTEN 0 128 :::38602 :::* vagrant@m040:~ ps -aef | grep mongod | grep -v grep
vagrant 1726 1 0 13:31 ? 00:00:56 mongod --dbpath /home/vagrant/repl/1 --logpath /home/vagrant/repl/1/log --port 27017 --replSet M040 --bind_ip_all --fork
vagrant 1810 1 0 13:31 ? 00:00:59 mongod --dbpath /home/vagrant/repl/2 --logpath /home/vagrant/repl/2/log --port 27027 --replSet M040 --bind_ip_all --fork
vagrant 1895 1 0 13:31 ? 00:00:54 mongod --dbpath /home/vagrant/repl/3 --logpath /home/vagrant/repl/3/log --port 27037 --replSet M040 --bind_ip_all --fork
vagrant@m040:~$

One thing I can see is that for mongosqld your specify m040 as replaca set name while your start mongod with M040.

that’s it. Thank you