Storage¶
Documentation¶
Local database format¶
+--------+ +---------------+
| HSET | | INFOS@HostID1 | -----> if : {JSON:Value:ID:...}
+--------+ +---------------+ |--> df : {JSON:Value:ID:...}
+---------------+
| INFOS@HostID2 | -----> if : {JSON:Value:ID:...}
+---------------+ |--> df : {JSON:Value:ID:...}
+--------+ +-------------+
| HSET | | HOSTS | -----> Host1 : { MyInfos }
+--------+ +-------------+ |--> Host2 : { MyInfos }
+--------+ +---------------+
| HSET | | HOST_ID | -----> HostID1 : md5sum(HostID1)
+--------+ +---------------+ |--> HostID2 : md5sum(HostID2)
+--------+ +-------------+
| HSET | | WSP_PATH | -----> HostID1 : /opt/wsp/1
+--------+ +-------------+ |--> HostID2 : /opt/wsp/2
+--------+ +------------------+
| HSET | | DELETED_HOSTS | -----> HostID3 : WSP_PATH
+--------+ +------------------+ |--> HostID4 : WSP_PATH
+--------+ +--------------------+
| HSET | | DELETED_PLUGINS | -----> HostID1@plugin : WSP_PATH/plugin
+--------+ +--------------------+ |--> HostID2@plugin : WSP_PATH/plugin
+-------+ +------------+
| SET | | OLD_WSP | -----> [WSP_PATH/plugin/wsp1, WSP_PATH/plugin/wsp2]
+-------+ +------------+
+-------+ +-------------------+
| SET | | LAST_WSP_CLEAN | -----> TimeStamp
+-------+ +-------------------+
Troubleshooting¶
Get the host list in the storage
redis-cli -n 2 HGETALL HOSTS
Get plugin info for a host
redis-cli -n 2 hget "INFOS@<hostid>" df
Get the wsp path for a host
redis-cli -n 2 hget "WSP_PATH" <hostid>
Test the storage¶
Get hosts list from the rest api
curl http://127.0.0.1:8080/numeter-storage/hosts
Get plugin list from the rest api for a host
curl http://127.0.0.1:8080/numeter-storage/list?host=1349792119-d753e11726b68a08dbb5847f0d4b8f8e
The rest api code can be found in /usr/share/numeter/storage/numeter_uwsgi.py
Installation¶
Warning
Do not forget to install a RPC like rabbitmq-server overview.html#components
Note
Numeter storage use nginx, python-flask and uwsgi to provide a “rest” api.
Debian packages¶
Build your own Debian packages with git-buildpackage or pbuilder for exemple or use numeter repo : http://repo.numeter.com (coming soon)
apt-get install numeter-storage
Note
numeter-common depends of python-oslo.messaging. Oslo.messaging is actually packaged only in jessie. If you build your own package for wheezy, actually you can find the others depends (oslo.config, stevedore) in this repository
deb http://cloud.pkgs.enovance.com/wheezy-grizzly grizzly main
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com E52660B15D964F0B
After that you need to configure nginx :
cp /usr/share/doc/numeter-storage/numeter-storage-web.nginx.example /etc/nginx/sites-available/numeter-storage-web
ln -s /etc/nginx/sites-available/numeter-storage-web /etc/nginx/sites-enabled/
/etc/init.d/nginx restart
Same thing for uwsgi :
cp /usr/share/doc/numeter-storage/numeter-storage-uwsgi.ini.example /etc/uwsgi/apps-available/numeter-storage-uwsgi.ini
ln -s /etc/uwsgi/apps-available/numeter-storage-uwsgi.ini /etc/uwsgi/apps-enabled/
/etc/init.d/uwsgi restart
See also
Manual¶
- Depends:
- python-kombu
- python-oslo.messaging
- numeter-common (rpc module)
- python-redis >= 2.4.9
- redis >= 2:2.4.14
- python-whisper
- nginx
- uwsgi
- python-flask
- python-daemon
- (rabbitmq-server)
Python-redis¶
Quick exemple of python-redis installation
From packages :
apt-get install python-redis
From sources :
git clone https://github.com/andymccurdy/redis-py
cd redis-py
python setup.py install
Python-daemon¶
Quick exemple of python-daemon installation
From packages :
apt-get install python-daemon
Python-kombu¶
Quick exemple of python-kombu installation
From packages :
apt-get install python-kombu
Python-oslo.messaging¶
Quick exemple of python-oslo.messaging installation
From packages :
apt-get install python-oslo.messaging
From sources : (Get tested version)
Depends
apt-get install python-dev python-setuptools
easy_install pip
Setup:
pip install git+git://github.com/openstack/oslo.messaging.git@7914181398630cbcbc25543d72871ccf812df517
Numeter storage¶
Get Numeter sources :
git clone https://github.com/enovance/numeter
cd numeter
Numeter common :
cd common && python setup.py install
Numeter storage :
cd storage && python setup.py install
After that you need to configure nginx :
cp storage/storage-web/numeter-storage-web.nginx.example /etc/nginx/sites-available/numeter-storage-web
ln -s /etc/nginx/sites-available/numeter-storage-web /etc/nginx/sites-enabled/
/etc/init.d/nginx reload
Same thing for uwsgi :
cp storage/storage-web/numeter-storage-uwsgi.ini.example /etc/uwsgi/apps-available/numeter-storage-uwsgi.ini
ln -s /etc/uwsgi/apps-available/numeter-storage-uwsgi.ini /etc/uwsgi/apps-enabled/
/etc/init.d/uwsgi restart
See also
Quick config¶
Numeter storage¶
Enable numeter storage:
vim /etc/numeter/numeter_storage.cfg
enable = false -> true
Add a poller in host-list file:
vim /etc/numeter/host-list
#Poller <hostID>
myhost-123456
Try to launch numeter-storage :
numeter-storage
Start numeter-storage daemon :
/etc/init.d/numeter-storage start