How to configure and configure mysql-proxy on ubuntu on amazon ec2

I am trying to configure mysql-proxy on ubuntu on amazon ec2 I did the following:

sudo apt-get install mysql-proxy --yes
vi /etc/default/mysql-proxy

I will put the following content on "/ etc / default / mysql-proxy"

ENABLED="true"
OPTIONS="--proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua
     --proxy-address=127.0.0.1:3306
     --proxy-backend-addresses=private_ip_of_another_ec2_db_server:3306,private_ip_of_another_ec2_db_server:3306"

also associated with "--proxy-address = private_ip_or_public_ip_of_proxy-server: 3306 or 4040" and "--proxy-backend-addresses = public_ip_of_another_ec2_db_server: 3306, public_ip_of_another_ec2_db_server: 3306"

after that I tried to connect the proxy server from another computer using mysql, for example:

mysql -u some_user -pxxxxx -h proxy_server_ip
or 
mysql -u some_user -pxxxxx -h proxy_server_ip -P 4040

but its error does not work:

ERROR 2003 (HY000): Can't connect to MySQL server on 'ip' (10061)

I want to say that you can connect the db server remotely, where I allowed remote connection to any host

I also tried to run /etc/init.d/mysql-proxy start or restart /etc/init.d/mysql-proxy, but could not get the result

, /etc/init.d/mysql-proxy stop

- mysql-proxy ubuntu

===

stackoverflow, , . , .

mysql-client mysql- ( -) mysql-proxy, :

mysql-proxy --proxy-backend-addresses=10.73.151.244:3306 --proxy-backend-addresses=10.73.198.7:3306 --proxy-address=:4040 --admin-username=root --admin-password=root --admin-lua-script=>/usr/lib/mysql-proxy/lua/admin.lua

- . , , , .

, - ?

+3
2

, Mysql- Mysql- mysql-.

mysql-proxy " ", .

Ubuntu Server, UPSTART script.

script /etc/init/mysql-proxy.conf

# mysql-proxy.conf (Ubuntu 14.04.1) Upstart proxy configuration file for AWS RDS
# mysql-proxy - mysql-proxy job file

description "mysql-proxy upstart script"
author "shadowbq <shadowbq@gmail.com>"

# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn

# When to start the service
start on runlevel [2345]

# When to stop the service
stop on runlevel [016]

# Automatically restart process if crashed
respawn

# Essentially lets upstart know the process will detach itself to the background
expect daemon

# Run before process
pre-start script
    [ -d /var/run/mysql-proxy ] || mkdir -p /var/run/mysql-proxy
    echo "starting mysql-proxy"
end script

# Start the process
exec /usr/bin/mysql-proxy --plugins=proxy --proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua --log-level=debug --proxy-backend-addresses=private_ip_of_another_ec2_db_server:3306,private_ip_of_another_ec2_db_server:3306 --daemon --log-use-syslog --pid-file=/var/run/mysql-proxy/mysql-proxy.pid

AWS RDS script, ,

+2

0.8.5

:

apt repo 0.8.5, tar mysql

: -

/etc/default/mysql-proxy ENABLED="true" OPTIONS="--defaults-file=/etc/mysql/mysql-proxy.cnf"

: -

  • mysql-proxy 0.8.x
  • Untar in/usr/local
  • PATH /usr/local/mysql -proxy-0.8.5-linux-debian6.0-x86-64bit/bin vim /etc/environment (to update environment path) cd /usr/local/mysql-proxy-0.8.5-linux-debian6.0-x86-64bit/bin

  • sudo./mysql-proxy --defaults-file =/etc/mysql/mysql-proxy.cnf

mysql-proxy.cnf

[mysql-proxy]
log-level=debug
log-file=/var/log/mysql-proxy.log
pid-file = /var/run/mysql-proxy.pid
daemon = true
--no-proxy = false
admin-username=ADMIN
admin-password=ADMIN
proxy-backend-addresses=RDS-ENDPOINT:RDS-PORT
admin-lua-script=/usr/lib/mysql-proxy/lua/admin.lua
proxy-address=0.0.0.0:4040
admin-address=localhost:4041
  1. IP- RDS mysql

  2. Mysql

    mysql -h {proxy-host-ip} -P 4040 -u {mysql_username} -p

+1

All Articles