Closed derekwong9 closed 6 years ago
what you have there will only work if there are no credentials required to access the database. Is credential-less access enabled?
yes, currently in the mongodb config file. Authorization is commented out.
#security:
# authorization: enabled
it does look like you'd need to use the full mongo URI if you are not using the default port. Are you able to change it to use the default port (just to see if it works)?
I have changed the mongo.conf to the following, in line with the default port.
# network interfaces
net:
port: 27017
bindIp: 192.168.0.210,192.168.0.211,127.0.0.1
in a jupyter notebook attempting to call
store = Arctic('197.168.0.211')
# or store = Arctic('197.168.0.211:27017')
store.list_libraries()
I have tested the connection directly with pymongo
import pymongo
client = pymongo.MongoClient("192.168.0.211", 27017)
db = client.arctic
db.name
output: 'arctic'
db.find
output: Collection(Database(MongoClient(host=['192.168.0.211:27017'], document_class=dict, tz_aware=False, connect=True), 'arctic'), 'find')
After store.list_libraries()
it still ServerSelectionTimeoutError: 197.168.0.211:27017: timed out . As I am able to make connections via pymongo and mongo client, I am not sure where else to look for possible fixes.
I appreciate your help finding a solution, and thanks for supporting the community.
the only thing i can think of is that i dont think arctic has been tested with mongo 3.6. If you are on 18.04 I'm guessing mongo is on the latest version (3.6). Can you confirm?
yes that is correct
MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.4
ok - I'll try with mongo 3.6 and see if it works for me or not
It works for me on 18.04 with mongo 3.6. This was what I ran:
In [1]: from arctic import Arctic
In [2]: a = Arctic('127.0.0.1')
In [3]: a.list_libraries()
Out[3]: []
In [4]: a.initialize_library('test.test')
In [5]: l = a['test.test']
In [6]: l.list_symbols()
Out[6]: []
Try to access it from another machine using an networked IP to get access. For example:
a = Arctic("192.168.0.123")
Then it will fail, mine works perfectly fine on local host.
Arctic uses pymongo's collection_names and database_names (it iterates over all databases and all collections in databases beginning with arctic). How many databases and collections do you have in your mongo server? Can you reproduce the issue by either calling database_names or by calling collection_names in any database starting with arctic?
i only have 2 dbs/collections ( i am not sure on terminology), on the server both arctic tick stores. I can connect and see the documents via pymongo, however in arctic i can not even make an initial connection and call. Not sure what I am supposed to to reproduce the issue, could you give me a list of steps?
any update on this?
I think there's something wrong with your connecting to Mongo. Try passing a working MongoClient into Arctic to figure out where this is going wrong for you...
m = MongoClient(<hostname>)
m.database_names()
a = Arctic(m)
a.list_libraries()
Note that all arctic does is initialise the mongo client with the string you pass in: https://github.com/manahl/arctic/blob/master/arctic/arctic.py#L128
Passing the mongo connection directly works perfectly.
from arctic import Arctic
from arctic import TICK_STORE
import pandas as pd
from pymongo import MongoClient
from arctic import Arctic
from arctic import TICK_STORE
import pandas as pd
from pymongo import MongoClient
m = MongoClient("192.168.0.210")
m.database_names()
['admin', 'arctic', 'config', 'local']
a = Arctic(m)
a.list_libraries()
['book5', 'trade']
Ok - and:
a = Arctic("192.168.0.210")
a.list_libraries()
a = Arctic("192.168.0.210")
a.list_libraries()
['book5', 'trade']
It works, how glorious. Now I am not really sure how I lost 2 weeks figuring this issue out, and have not really changed anything since install except 1 server reboot. Thanks for your support guys.
The issue was that you used 197 instead of 192 for the first part of your IP address
Arctic Version
Arctic Store
Platform and version
Ubuntu 18.04 LTS (mongodb)
Description of problem and/or code sample that reproduces the issue
I am trying to access a mongodb instance on the network, I have been able to connect via MongoDB CLI and Compass via the ip:port call below. But somehow when I run it I get a server timeout?
I checked the pymongo call to connect, and attempted to use the full mongo URI but it still fails any call to the database.