Skip to content

Installing Shard Query

2803media edited this page Mar 28, 2017 · 2 revisions
  1. Install gearmand

  2. Install MySQL on each storage node (one or more databases)

  3. Install apache or apache2 php php-mysql php-pear

  4. Download and extract swanhart-tools. Move shard-query to /usr/share/ (so you have /usr/share/shard-query/include, etc..)

  5. 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)

  1. copy bootstrap.ini.example to bootstrap.ini and edit it appropriately

  2. php setup_virtual_schema.php --ini=bootstrap.ini

  3. start gearman:

  • gearmand -d -p 7001 -L 127.0.0.1
  1. test a worker:
  • cd bin/
  • ./worker

If no errors in 10 to 15 seconds hit ctrl-c.

  1. start workers
  • ./start_workers 6 (where 6 = number of workers you want to start)

UI installation (CentOS 6.4)

  1. Copy /usr/share/tools/shard-query.conf into /etc/http/conf.d
  2. Restart apache
  3. Copy bundle/dooframework into /usr/share
  4. chmod -R a+r /usr/share/dooframework

Test:

Proxy installation

  1. Make sure boost-devel, libevent-devel and mysql-devel and openssl-devel are installed
  2. Download the latest version of gearman-mysql-udf
  3. Compile and install the UDF
  4. Configure the UDF:
  • select gman_set_servers('127.0.0.1:7001');
  1. Download and install MySQL proxy in /usr/local/mysql-proxy.
  2. 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