In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Environment:
Master:192.168.71.128 mysql-sql-node1
Slave:192.168.71.140 mysql-data-node1
Mysql-Proxy:192.168.71.138 mysql-mgm-node
Rpm-Q libevent glib2 pkgconfig libtool mysql-devel to see if the above packages are installed on the system, and if not, install them using yum install.
Yum install-y libtermcap-devel ncurses-devel libevent-devel readline-devel gcc-c++
I. download the program:
Wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
Wget http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-Proxy/mysql-proxy-0.6.0.tar.gz
Wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
Second, install lua:
[root@mailtest / software] # tar zxvf lua-5.1.4.tar.gz
[root@mailtest lua-5.1.4] # cd lua-5.1.4
[root@mailtest lua-5.1.4] # # vi Makefile
Modify:
INSTALL_TOP= / usr/local/lua
[root@mailtest lua-5.1.4] # make & & make linux & & make install
Set environment variabl
[root@mailtest lua-5.1.4] # export LUA_CFLAGS= "- I/usr/local/lua/include" LUA_LIBS= "- L/usr/local/lua/lib-llua-ldl" LDFLAGS= "- L/usr/local/libevent/lib-lm"
[root@mailtest lua-5.1.4] # export CPPFLAGS= "- I/usr/local/libevent/include"
[root@mailtest lua-5.1.4] # export CFLAGS= "- I/usr/local/libevent/include"
3. Install libevent:
Tar zvxf libevent-1.4.13-stable.tar.gz
Cd libevent-1.4.13-stable
. / configure-- prefix=/usr/local/libevent
Make & & make install
4. Install mysql-proxy:
. / configure-- prefix=/usr/local/mysql-proxy-- with-mysql=/usr/local/mysql-- with-lua
Make & & make install
Start:
/ usr/local/mysql-proxy/sbin/mysql-proxy-proxy-read-only-backend-addresses=192.168.71.140:3306-proxy-backend-addresses=192.168.71.128:3306-proxy-lua-
Script=/usr/local/mysql-proxy/share/mysql-proxy/rw-splitting.lua &
View the process:
Netstat-ntlp | grep mysql
Edit the startup script:
Vi / etc/init.d/mysql-proxy
#! / bin/bash
PRODIR=/usr/local/mysql-proxy
LUA_PATH=$PRODIR/share/mysql-proxy
Start () {
$PRODIR/sbin/mysql-proxy-proxy-read-only-backend-addresses=192.168.71.140:3306-proxy-backend-addresses=192.168.71.128:3306-proxy-lua-
Script=/usr/local/mysql-proxy/share/mysql-proxy/rw-splitting.lua &
> > $PRODIR/mysql-proxy.log &
}
Stop () {
Kill $(pidof mysql-proxy)
If [$?-ne 0]; then
Kill-9 $(pidof mysql-proxy)
Fi
}
Case "$1" in
Start)
Start
Stop)
Stop
Restart)
Stop
Start
*)
Echo $"Usage: $0 {start | stop | restart}"
Esac
Modify permissions:
Chmod + x / etc/init.d/mysql-proxy
/ etc/init.d/mysql-proxy start
Test:
Create the test database and users on MySQL-Master.
Mysql > create database unixhot
Mysql > GRANT ALL PRIVILEGES ON king.* to proxytest@'%' identified by 'bobo365'
Connection test
[root@MySQL-Proxy] # mysql-h 192.168.71.138-P 4040-u proxytest-p
Enter your password to log in.
Mysql > show processlist
+-+
| | Id | User | Host | db | Command | Time | State | Info |
+-+
| | 14 | proxytest | 192.168.71.138Sleep 17350 | NULL | Sleep | 2 | NULL |
| | 15 | proxytest | 192.168.71.138Query 17355 | NULL | Query | 0 | NULL | show processlist |
| | 16 | proxytest | 192.168.71.138Sleep 17358 | NULL | Sleep | 2 | NULL |
+-+
3 rows in set (0.01sec)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.