gaurav1207
gaurav1207

Reputation: 703

unable to connect mongoDB and neo4j

I'm following the steps provide at URL https://neo4j.com/developer/neo4j-doc-manager/ to connect mongoDb and neo4j.

  1. In terminal started, mongod --replSet myDevReplSet
  2. In new terminal started mongo shell, mongo
  3. typed rs.initiate() in shell
  4. Again in new terminal typed, mongo-connector -m localhost:27017 -t http://localhost:7474/db/data -d neo4j_doc_manager

But I get an error as:

Exception in thread Thread-1: Traceback (most recent call last): File "/Users/gauravvashisth/anaconda/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/mongo_connector/util.py", line 104, in wrapped func(*args, **kwargs) File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/mongo_connector/connector.py", line 382, in run self.update_version_from_client(self.main_conn) File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/mongo_connector/connector.py", line 334, in update_version_from_client is_master = client.admin.command("isMaster") File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/pymongo/database.py", line 491, in command with client._socket_for_reads(read_preference) as (sock_info, slave_ok): File "/Users/gauravvashisth/anaconda/lib/python3.5/contextlib.py", line 59, in enter return next(self.gen) File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/pymongo/mongo_client.py", line 859, in _socket_for_reads with self._get_socket(read_preference) as sock_info: File "/Users/gauravvashisth/anaconda/lib/python3.5/contextlib.py", line 59, in enter return next(self.gen) File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/pymongo/mongo_client.py", line 823, in _get_socket server = self._get_topology().select_server(selector) File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/pymongo/topology.py", line 214, in select_server address)) File "/Users/gauravvashisth/anaconda/lib/python3.5/site-packages/pymongo/topology.py", line 189, in select_servers self._error_message(selector))

pymongo.errors.ServerSelectionTimeoutError: No replica set members match selector "Primary()"

Upvotes: 0

Views: 374

Answers (1)

szenyo
szenyo

Reputation: 522

You should have at least one replicaset member in MongoDB. You can query the members with rs.conf() command in mongo shell. If it does not have a member, then you can do this:

    cfg = {
    ...     "_id" : "rs0",
    ...     "version" : 1,
    ...     "members" : [
    ...         {
    ...             "_id" : 0,
    ...             "host" : "localhost:27017"
    ...         }
    ...     ]
    ... }

    >rs.reconfig(cfg, {force:true})

Upvotes: 1

Related Questions