首页 > 数据库 > 文库 > 正文

安装部署PhxSQL教案

2024-09-07 22:12:52
字体:
来源:转载
供稿:网友
  需求:公司某软件使用phxsql已经部署在3个机房,现需要在新的机房增加一个phxsql节点,以下为操作过程,因为保护隐私把4台IP用
 
  1.1.1.1
 
  2.2.2.2
 
  3.3.3.3
 
  新的ip为4.4.4.4
 
  。安装Phxsql需要Python2.7版本,Centos默认为2.6版本,需要进行升级
 
  cd /opt
  wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
  tar xf Python-2.7.6.tar.xz
  cd Python-2.7.6
  ./configure --prefix=/usr/local
  make && make install
  。Phxsql需要升级glibc包,Centos6.5默认为2.12版本,升级为2.20版本。因为glic是操作系统底层库,谨慎操作
 
  glibc-common-2.12-1.149.el6_6.5.x86_64
  glibc-2.12-1.149.el6_6.5.i686
  glibc-2.12-1.149.el6_6.5.x86_64
  glibc-headers-2.12-1.149.el6_6.5.x86_64
  glibc-devel-2.12-1.149.el6_6.5.x86_64
  升级操作
 
  rpm -Uvh --aid --force --nodeps glibc-headers-2.20-8.fc21.x86_64.rpm
  rpm -Uvh --aid --force --nodeps glibc-devel-2.20-8.fc21.x86_64.rpm
  rpm -Uvh --aid --force --nodeps glibc-2.20-8.fc21.x86_64.rpm
  rpm -Uvh --aid --force --nodeps glibc-common-2.20-8.fc21.x86_64.rpm
  。四个phxsql节点的服务器,防火墙需要开放如下几个端口
 
  iptables -A INPUT -p tcp -m multiport --dports 11111,54321,54322 -s 4.4.4.4 -j ACCEPT
  。在phxsql集群里任意一个节点,在新节点还没有开始安装部署phxsql时,把新节点IP添加到集群里面
 
  phxbinlogsvr_tools_phxrpc -f AddMember -h2.1.1.1 -p17000 -m 4.4.4.4
  加后使用命令行检查
 
  phxbinlogsvr_tools_phxrpc -f GetMemberList -h2.1.1.1 -p 17000
  。设置phxsql的数据目录,官网教程定义目录为/tmp/data,这里改为/data1/
 
  cd /data1/phxsql/tools/
  mkdir -p /data1/phxsql/tmp/data/log
  chown -R mysql:mysql /data1/phxsql/tmp/data/log
  python2.7 install.py -i"4.4.4.4" -p 54321 -g 6000 -y 11111 -P 17000 -a 8001 -f /data1/phxsql/tmp/data/
  安装过程会出现如下信息
 
  Namespace(agent_port=6000, base_dir='/data1/phxsql/', data_dir='/data1/phxsql/tmp/data/', inner_ip='183.36.122.100', ip_list='4.4.4.4', module_name='test', mysql_port=11111, paxos_port=8001, phxbinlogsvr_port=17000, phxsqlproxy_port=54321, process_name='all', skip_data=0)
  kill all binaries success....
  mkdir: cannot create directory `/data1/phxsql/etc': File exists
  generate all configs success....
  mkdir: cannot create directory `/data1/phxsql/tmp/data/log': File exists
  /data1/phxsql/tmp/data/phxbinlogsvr
  skip data 0
  mkdir: cannot create directory `/data1/phxsql/tmp/data/log': File exists
  /data1/phxsql/tmp/data/percona.workspace
  cd /data1/phxsql/percona.src; ./scripts/mysql_install_db --defaults-file=/data1/phxsql/etc/my.cnf --user=mysql
  WARNING: The host 'centos' could not be looked up with /data1/phxsql/percona.src/bin/resolveip.
  This probably means that your libc libraries are not 100 % compatible
  with this binary MySQL version. The MySQL daemon, mysqld, should work
  normally with the exception that host name resolving will not work.
  This means that you should use IP addresses instead of hostnames
  when specifying MySQL privileges !
  Installing MySQL system tables...2017-05-04 04:07:27 0 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
  2017-05-04 04:07:27 0 [Note] ./bin/mysqld (mysqld 5.6.31-77.0-log) starting as process 55454 ...
 
  killall -9 phxbinlogsvr_phxrpc
  。添加环境变量
 
  vi /etc/profile
  export PATH=/data1/phxsql/sbin:$PATH
  . /etc/profile
  。phxsql安装好了,目前是空的,需要从一个有数据的节点上把数据导过来,通常会选择从点,通过命令查询哪个是master,然后避开master,我这边数据量是200G,对于导出大量的数据会很消耗磁盘资源,需要让业务切换到其他点。

(编辑:武林网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表