-
Notifications
You must be signed in to change notification settings - Fork 141
Installing Shard Query
2803media edited this page Mar 28, 2017
·
2 revisions
-
Install gearmand
-
Install MySQL on each storage node (one or more databases)
-
Install apache or apache2 php php-mysql php-pear
-
Download and extract swanhart-tools. Move shard-query to /usr/share/ (so you have /usr/share/shard-query/include, etc..)
-
Install the config repo
- cd /usr/share/shard-query
- php install_config_repo.php
Make sure that the account you use to set up the repo was created WITH GRANT OPTION. That is really important. Same thing goes for account used to set up virtual schema. It must be able to delegate grants to the shard_query user (or whatever you select in the setup)
-
copy bootstrap.ini.example to bootstrap.ini and edit it appropriately
-
php setup_virtual_schema.php --ini=bootstrap.ini
-
start gearman:
- gearmand -d -p 7001 -L 127.0.0.1
- test a worker:
- cd bin/
- ./worker
If no errors in 10 to 15 seconds hit ctrl-c.
- start workers
- ./start_workers 6 (where 6 = number of workers you want to start)
- Copy /usr/share/tools/shard-query.conf into /etc/http/conf.d
- Restart apache
- Copy bundle/dooframework into /usr/share
- chmod -R a+r /usr/share/dooframework
Test:
- http://localhost/shard-query
- Default username: user
- Default password: mpp
- Make sure boost-devel, libevent-devel and mysql-devel and openssl-devel are installed
- Download the latest version of gearman-mysql-udf
- Compile and install the UDF
- Configure the UDF:
- select gman_set_servers('127.0.0.1:7001');
- Download and install MySQL proxy in /usr/local/mysql-proxy.
- Start the proxy and use the -s option to point the proxy to the Shard-Query LUA script:
- mysql-proxy -P 127.0.0.1:4042 -b 127.0.0.1:3306 -s /usr/share/shard-query/proxy/mysqlproxy.lua --admin username=root --admin-password=admin --admin-lua-script=/usr/local/lib/mysql-proxy/lua/admin.lua --daemon --log-file=/usr/share/shard-query/log/proxy.log