ubuntu14.04 部署atlas


声明:本文转载自https://my.oschina.net/qiongtaoli/blog/1505554,转载目的在于传递更多信息,仅供学习交流之用。如有侵权行为,请联系我,我会及时删除。

插播一条广告→2021 ByteDance字节跳动内推←各城市、各方向的岗位都有,大量招人!


ipv6自动跳转到ipv4

sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|g' /etc/sysctl.conf

创建docker容器

docker run -h mysql_master --name mysql_master -p 3306:3306 -v /data:/data -it ubuntu:14.04 /bin/bash  docker run -h mysql_slave --name mysql_slave -p 3307:3306 -v /data:/data --link=mysql_master:mysql_master -it ubuntu:14.04 /bin/bash  docker run -h atlas --name atlas -p 3305:3305 -v /data:/data --link=mysql_master:mysql_master --link=mysql_slave:mysql_slave -it ubuntu:14.04 /bin/bash

配置并安装库    

echo "Asia/shanghai" > /etc/timezone cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  cp -a /etc/apt/sources.list /etc/apt/sources.list.bak  cat > /etc/apt/sources.list <<EOF deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse EOF  apt-get update apt-get install -y wget vim telnet  apt-get autoclean apt-get clean apt-get autoremove

mysql_master    

apt-get install -y mysql-server-5.6  cp -a /etc/mysql/my.cnf /etc/mysql/my.cnf.bak  sed -i 's|/var/log/mysql|/data/mysql_master/log|g' /etc/mysql/my.cnf sed -i 's|/var/lib/mysql|/data/mysql_master/data|g' /etc/mysql/my.cnf sed -i 's|bind-address|#bind-address|g' /etc/mysql/my.cnf  [mysqld] server-id=1 log-bin=mysql-bin binlog_ignore_db=mysql innodb_flush_log_at_trx_commit=1 sync_binlog=1  mkdir -p /data/mysql_master/log mkdir -p /data/mysql_master/data  cp -a /var/lib/mysql/* /data/mysql_master/data chown -R mysql:mysql /data/mysql_master  service mysql start ps -ef|grep mysql  mysql -uroot -p123456 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';FLUSH PRIVILEGES;" mysql -uroot -p123456 -e "show master status"

mysql_slave    

apt-get install -y mysql-server-5.6  cp -a /etc/mysql/my.cnf /etc/mysql/my.cnf.bak  sed -i 's|/var/log/mysql|/data/mysql_slave/log|g' /etc/mysql/my.cnf sed -i 's|/var/lib/mysql|/data/mysql_slave/data|g' /etc/mysql/my.cnf sed -i 's|bind-address|#bind-address|g' /etc/mysql/my.cnf  [mysqld] server-id=2  mkdir -p /data/mysql_slave/log mkdir -p /data/mysql_slave/data  cp -a /var/lib/mysql/* /data/mysql_slave/data chown -R mysql:mysql /data/mysql_slave  service mysql start ps -ef|grep mysql  mysql -uroot -p123456 -e "stop slave"; mysql -uroot -p123456 -e "change master to master_host='mysql_master',master_user='root',master_password='123456'"; mysql -uroot -p123456 -e "start slave"; mysql -uroot -p123456 -e "show slave status\G";

atlas    

apt-get install -y libmysqlclient18 mysql-client-core-5.6 wget https://github.com/Qihoo360/Atlas/releases/download/2.2/Atlas-2.2-debian7.0-x86_64.deb dpkg -i Atlas-2.2-debian7.0-x86_64.deb  mkdir -p /data/atlas/log  cat > /usr/local/mysql-proxy/conf/atlas.cnf <<EOF [mysql-proxy] admin-username = root admin-password = 123456 admin-lua-script = /usr/local/mysql-proxy/lib/mysql-proxy/lua/admin.lua proxy-backend-addresses = mysql_master:3306 proxy-read-only-backend-addresses = mysql_slave:3306 pwds = root:islyU4IfJ/k= daemon = true keepalive = true event-threads = 8 log-level = message log-path = /data/atlas/log instance = atlas proxy-address = 0.0.0.0:3305 admin-address = 0.0.0.0:3304 min-idle-connections = 16 charset = utf8 EOF  /usr/local/mysql-proxy/bin/mysql-proxyd atlas start  mysql -h127.0.0.1 -P3305 -uroot -p123456 -e "select * from help"

 防火墙开放端口    

vim /etc/iptables/rules.v4    -A INPUT -p tcp -m tcp --dport 3305 -j ACCEPT  iptables-restore < /etc/iptables/rules.v4 iptables -L -n

 

本文发表于2017年08月10日 08:36
(c)注:本文转载自https://my.oschina.net/qiongtaoli/blog/1505554,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如有侵权行为,请联系我们,我们会及时删除.

阅读 1317 讨论 0 喜欢 0

抢先体验

扫码体验
趣味小程序
文字表情生成器

闪念胶囊

你要过得好哇,这样我才能恨你啊,你要是过得不好,我都不知道该恨你还是拥抱你啊。

直抵黄龙府,与诸君痛饮尔。

那时陪伴我的人啊,你们如今在何方。

不出意外的话,我们再也不会见了,祝你前程似锦。

这世界真好,吃野东西也要留出这条命来看看

快捷链接
网站地图
提交友链
Copyright © 2016 - 2021 Cion.
All Rights Reserved.
京ICP备2021004668号-1