-
Notifications
You must be signed in to change notification settings - Fork 11
Set up the Data Broker
Developers: Arman Arkilic, Eric Dill
- Install pymongo
- Install metadataStore
- Set up on mac
- Set up on win7
- Set up on debianwheezy
- Set up on ChannelArchiverCSX
- metadataStore usage
- Use anaconda to manage python libraries
- Download anaconda
- Install anaconda into your home directory:
bash Anaconda-[version].sh
- Check that your python version is running from ~/anaconda/bin/python
- If
which python
does not return/home/username/anaconda/bin/
, do not go to the next step until it does!!
- Install pymongo
- Make the directory to house the database
mkdir /var/tmp/mongo_data
- Install metadataStore
- Start the mongo database server in one terminal
sudo mongod --dbpath /var/tmp/mongo_data
- Go to usage
- Install mongodb 1::2.0.6-1.1
- sudo apt-get install mongodb
- Install pymongo
- Make the directory to house the database
mkdir /var/tmp/mongo_data
- Install metadataStore
- Start the mongo database server in one terminal
sudo mongod --dbpath /var/tmp/mongo_data
- Go to usage
-
Download mongodb
- 64-bit install
- Run the installer
mongodb-win32-[architecture]-[version]
(e.g.: mongodb-win32-x86_64-2008plus-2.6.4-signed) - Install Typical configuration
- Add C:Program FilesMongoDB 2.6 Standardbin to your system path
- press
win
+pause
to openControl Panel\All Control Panel Items\System
- open
Advanced system settings
(item is on the left sidebar) - open the
Advanced
tab - open
Environment Variables
- find
Path
in theSystem variables
section of the window that just popped up - click on
Path
and thenEdit
- go to the end of the editable line with the label
Variable value:
- add the following text:
;"C:\Program Files\MongoDB 2.6 Standard\bin";
- click ok a number of times to close all popup windows
- press
-
Configure mongodb
-
Follow these instructions
-
create a location to house the mongo data
- I'm using
c:\var\tmp\mongo_data
- I'm using
-
start the mongo db in a terminal with elevated permissions (see next bullet):
mongod --dbpath c:\var\tmp\mongo_data
and you should get something like this:C:\dev\mongodb>mongod --dbpath \var\tmp\mongo_data 2014-08-30T10:35:29.004-0400 [initandlisten] MongoDB starting : pid=8344 port=27017 dbpath=\dev\mongodb\mongo_data 64-bit host=Eric-i5-desktop 2014-08-30T10:35:29.005-0400 [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2 2014-08-30T10:35:29.006-0400 [initandlisten] db version v2.6.4 2014-08-30T10:35:29.006-0400 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910 2014-08-30T10:35:29.006-0400 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49 2014-08-30T10:35:29.006-0400 [initandlisten] allocator: system 2014-08-30T10:35:29.007-0400 [initandlisten] options: { storage: { dbPath: "\dev\mongodb\mongo_data" } } 2014-08-30T10:35:29.010-0400 [initandlisten] journal dir=\dev\mongodb\mongo_data\journal 2014-08-30T10:35:29.011-0400 [initandlisten] recover : no journal files present, no recovery needed 2014-08-30T10:35:29.029-0400 [FileAllocator] allocating new datafile \dev\mongodb\mongo_data\local.ns, filling with zeroes... 2014-08-30T10:35:29.030-0400 [FileAllocator] creating directory \dev\mongodb\mongo_data\_tmp 2014-08-30T10:35:29.063-0400 [FileAllocator] done allocating datafile \dev\mongodb\mongo_data\local.ns, size:16MB, took 0.032 secs 2014-08-30T10:35:29.065-0400 [FileAllocator] allocating new datafile \dev\mongodb\mongo_data\local.0, filling with zeroes... 2014-08-30T10:35:29.171-0400 [FileAllocator] done allocating datafile \dev\mongodb\mongo_data\local.0, size: 64MB, took 0.104 secs 2014-08-30T10:35:29.173-0400 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" } 2014-08-30T10:35:29.173-0400 [initandlisten] added index to empty collection 2014-08-30T10:35:29.174-0400 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0 reslen:37 144ms 2014-08-30T10:35:29.174-0400 [initandlisten] waiting for connections on port 27017
-
elevated terminal permissions on windows:
- open the start menu
- type
cmd
- right click on
cmd
and click onRun as administrator
-
install pymongo
-
install metadataStore
-
run
metadataStore\examples\sample_code_raw.py
to ensure that the metadataStore is functional
-
-
go to usage
-
ssh to the channel archiver
ssh xf23id-ca
-
Install mongodb 1::2.0.6-1.1
- sudo apt-get install mongodb
-
Check to see if pymongo 2.7.1 is already installed with
conda list pymongo
orpip list pymongo
- Note 1:
mongoengine-0.8.7
requirespymongo>=2.5
- Note 2: You'll probably need to download pymongo with a web browser and then use sftp to put it on the channel archiver since
wget
andpip
don't seem to be working due to http proxy issues - If you have at least this version, great! Otherwise, continue with this list
- Install pymongo 2.7.1 or use the direct link
cd ~/dev/other_src/
tar -xf ~/Downloads/pymongo-2.7.1.tar.gz
pip install ./pymongo-2.7.1.tar.gz
- Note 1:
-
- Download from the above link
- Note that if you're at the beamline computers you'll probably need to download pymongo with a web browser and then use sftp to put it on the channel archiver.
cd ~/dev/other_src/
tar -xf ~/Downloads/mongoengine-0.8.7.tar.gz
pip install ./mongoengine-0.8.7
- Download from the above link
-
Make the directory to house the database
mkdir /DATA
mkdir /DATA/broker
-
Start the mongodb
-
sudo mongod --dbpath /DATA/broker
-
If you run into an error that looks like this:
edill@xf23id-ca:~/mongo_setup$ sudo mongod --dbpath /DATA/broker Fri Jul 11 09:29:26 [initandlisten] MongoDB starting : pid=3314 port=27017 dbpath=/DATA/broker 64-bit host=xf23id-ca Fri Jul 11 09:29:26 [initandlisten] Fri Jul 11 09:29:26 [initandlisten] ** WARNING: You are running on a NUMA machine. Fri Jul 11 09:29:26 [initandlisten] ** We suggest launching mongod like this to avoid performance problems: Fri Jul 11 09:29:26 [initandlisten] ** numactl --interleave=all mongod [other options] Fri Jul 11 09:29:26 [initandlisten] Fri Jul 11 09:29:26 [initandlisten] db version v2.0.6, pdfile version 4.5 Fri Jul 11 09:29:26 [initandlisten] git version: nogitversion Fri Jul 11 09:29:26 [initandlisten] build info: Linux z6 3.8-trunk-amd64 #1 SMP Debian 3.8.3-1~experimental.1 x86_64 BOOST_LIB_VERSION=1_49 Fri Jul 11 09:29:26 [initandlisten] options: { dbpath: "/DATA/broker" } Fri Jul 11 09:29:26 [initandlisten] journal dir=/DATA/broker/journal Fri Jul 11 09:29:26 [initandlisten] recover : no journal files present, no recovery needed Fri Jul 11 09:29:26 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017 Fri Jul 11 09:29:26 [initandlisten] ERROR: addr already in use Fri Jul 11 09:29:26 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017 Fri Jul 11 09:29:26 [websvr] ERROR: addr already in use Fri Jul 11 09:29:26 [initandlisten] now exiting Fri Jul 11 09:29:26 dbexit: Fri Jul 11 09:29:26 [initandlisten] shutdown: going to close listening sockets... Fri Jul 11 09:29:26 [initandlisten] shutdown: going to flush diaglog... Fri Jul 11 09:29:26 [initandlisten] shutdown: going to close sockets... Fri Jul 11 09:29:26 [initandlisten] shutdown: waiting for fs preallocator... Fri Jul 11 09:29:26 [initandlisten] shutdown: lock for final commit... Fri Jul 11 09:29:26 [initandlisten] shutdown: final commit... Fri Jul 11 09:29:26 [initandlisten] shutdown: closing all files... Fri Jul 11 09:29:26 [initandlisten] closeAllFiles() finished Fri Jul 11 09:29:26 [initandlisten] journalCleanup... Fri Jul 11 09:29:26 [initandlisten] removeJournalFiles Fri Jul 11 09:29:26 [initandlisten] shutdown: removing fs lock... Fri Jul 11 09:29:26 dbexit: really exiting now
-
Find the pid of the currently running mongod:
edill@xf23id-ca:~/mongo_setup$ ps -e | grep mongo 300 ? 00:00:09 mongod
-
In this case, the pid is 300
- CHECK WITH THE BEAMLINE SCIENTIST FIRST TO MAKE SURE IT IS OK TO TERMINATE THIS DB INSTANCE!
- Then kill it with
kill -9 300
- Restart mongo
sudo mongod --dbpath /DATA/broker
-
-
Return to your local computer (i.e., not the ssh target)
-
Install metadataStore
- edit the dataBroker.conf file so that the host is
xf23id-broker
- edit the dataBroker.conf file so that the host is
-
Go to usage to test the data broker
-
Copy
sampleCode.py
from ~/path_to_metadataStore_repository/sampleCode.py to some other folder so that it runs from the pip installed version, not the local repo- cp ~/dev/my_src/metadataStore/sampleCode.py ~/
-
Start an ipython session in another terminal
-
%run ~/sampleCode.py
-
You should see the database server terminal make some updates, something like:
Thu Jul 10 17:33:34 [initandlisten] connection accepted from 127.0.0.1:41132 #1 Thu Jul 10 17:33:34 [FileAllocator] allocating new datafile /var/tmp/mongo_data/metaDataStore.ns, filling with zeroes... Thu Jul 10 17:33:34 [FileAllocator] creating directory /var/tmp/mongo_data/_tmp Thu Jul 10 17:33:34 [FileAllocator] done allocating datafile /var/tmp/mongo_data/metaDataStore.ns, size: 16MB, took 0.016 secs Thu Jul 10 17:33:34 [FileAllocator] allocating new datafile /var/tmp/mongo_data/metaDataStore.0, filling with zeroes... Thu Jul 10 17:33:34 [FileAllocator] done allocating datafile /var/tmp/mongo_data/metaDataStore.0, size: 64MB, took 0.487 secs
-
-
Still within the ipython interpreter
-
Test the search functionality
-
from metadataStore.userapi.commands import search
-
search(owner='arkilic')
should result in something like the following:In [6]: search(owner='arkilic') None Out[6]: [{u'_id': 1903, u'beamline_id': u'csx', u'custom': {}, u'end_time': datetime.datetime(2014, 7, 10, 21, 33, 34, 408000), u'owner': u'arkilic', u'start_time': datetime.datetime(2014, 7, 10, 21, 33, 34, 408000), u'update_time': datetime.datetime(2014, 7, 10, 21, 33, 34, 408000)}, {u'_id': 1905, u'beamline_id': u'csx', u'custom': {}, u'end_time': datetime.datetime(2014, 7, 10, 21, 33, 34, 988000), u'owner': u'arkilic', u'start_time': datetime.datetime(2014, 7, 10, 21, 33, 34, 988000), u'update_time': datetime.datetime(2014, 7, 10, 21, 33, 34, 988000)}]
-
- Check to see if pymongo 2.7.1 is already installed with
conda list pymongo
orpip list pymongo
- Note that
mongoengine-0.8.7
requirespymongo>=2.5
- If you have at least this version, great! Otherwise, continue with this list
- Install pymongo 2.7.1 or use the direct link
cd ~/dev/other_src/
tar -xf ~/Downloads/pymongo-2.7.1.tar.gz
pip install ./pymongo-2.7.1/
- Or just
pip install pymongo
- Note that
- Clone and install the metadataStore repository (the data broker)
cd ~/dev/other_src/
git clone https://github.com/arkilic/metadataStore.git
cd metadataStore
python setup.py develop
- the metadataStore defaults to using
localhost
as the mongo db host