ansible-galera集群部署(13)
一、环境准备
1、各主机配置静态域名解析:
- [root@node1 ~]# cat /etc/hosts
- 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
- :: localhost localhost.localdomain localhost6 localhost6.localdomain6
- 172.16.254.20 reg.yunwei.edu
- #192.168.42.30 reg.yunwei.edu
- 192.168.42.172 node3
- 192.168.42.122 node2
- 192.168.42.121 node1
- 192.168.42.30 dlp
2、并配置各节点ssh无密钥登陆
3、安装docker环境
- [root@node1 ~]# ls
- anaconda-ks.cfg docker docker.tar.gz image yum-repo.sh
- [root@node1 ~]# cd docker
- [root@node1 docker]# ls
- ca.crt docker-app.tar.gz docker.sh remove.sh
- [root@node1 docker]# bash docker.sh
4、下载配置文件并且导入镜像
- wget http://download2.yunwei.edu/shell/ansible-galera.tar.gz
[root@dlp ~]# ls
anaconda-ks.cfg config.tar.gz docker.tar.gz kubernetes.tar.gz test username
ansible-galera.tar.gz data galera.tar.gz mariadb-galera.tar total.sh yum-repo.sh
bash-completion-2.1-6.el7.noarch.rpm docker kubernetes password try.html
[root@dlp ~]# tar xf ansible-galera.tar.gz
[root@dlp ~]# ls
anaconda-ks.cfg bash-completion-2.1-6.el7.noarch.rpm docker kubernetes password try.html
ansible-galera config.tar.gz docker.tar.gz kubernetes.tar.gz test username
ansible-galera.tar.gz data galera.tar.gz mariadb-galera.tar total.sh yum-repo.sh
[root@dlp ~]# cd ansible-galera
[root@dlp ansible-galera]# ls
bin delete.yml hosts install.yml roles
[root@dlp ansible-galera]# mv * /etc/ansible/
[root@dlp ansible-galera]# cd /etc/ansible/
[root@dlp ansible]# ls
bin delete.yml hosts install.yml roles- wget http://download2.yunwei.edu/shell/galera.tar.gz
[root@dlp ~]# mv config.tar.gz mariadb-galera.tar /etc/ansible/bin/
[root@dlp ~]# cd /etc/ansible/
[root@dlp ansible]# ls
bin delete.yml hosts install.yml roles
[root@dlp ansible]# cat hosts
[all]
192.168.42.121
192.168.42.122
192.168.42.172- [master]
192.168.42.121- [slave1]
192.168.42.122- [slave2]
192.168.42.172- [all:vars]
#定义集群ip
master="192.168.42.121"
slave1="192.168.42.122"
slave2="192.168.42.172"- #部署目录,即 ansible 工作目录
base_dir="/etc/ansible"- #默认软件安装目录
opt_dir="/opt"- 在部署节点:
- 进入容器设置免密钥,测试是否能ping通:
ansible all -m ping
/ # cd /etc/ansible/
/etc/ansible # ls
bin delete.yml hosts install.yml roles
/etc/ansible # ansible-playbook install.yml
二、配置集群
三、查看集群是否同步
- [root@node1 docker]# docker ps -a
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 08ccff9d97ad panubo/mariadb-galera "/galera-entrypoint.…" minutes ago Up minutes galera1
- [root@node1 docker]# docker exec -it 08ccff9d97ad sh
- # mysql -uroot -p123
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is
- Server version: 10.1.-MariaDB-~jessie mariadb.org binary distribution
- Copyright (c) , , Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> SHOW STATUS LIKE 'wsrep_cluster_size';
- +--------------------+-------+
- | Variable_name | Value |
- +--------------------+-------+
- | wsrep_cluster_size | |
- +--------------------+-------+
- row in set (0.34 sec)
- MariaDB [(none)]> create database test1;
- Query OK, row affected (0.30 sec)
- [root@node2 ~]# docker exec -it d8b804886305 sh
- # mysql -uroot -p123
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is
- Server version: 10.1.-MariaDB-~jessie mariadb.org binary distribution
- Copyright (c) , , Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | test |
- | test1 |
- +--------------------+
- rows in set (0.73 sec)
四、登陆数据库时,安装mariadb客户端
五、故障恢复:
ansible-galera集群部署(13)的更多相关文章
- Docker 版ansible galera集群
1. 部署galera集群 利用四台主机cicd.node1.node2.node3来搭建galera集群. 1> 上传压缩包至cicd,解压得到ansible配置文件 [root@cicd ~ ...
- MariaDB Galera集群部署--技术流ken
Galera集群介绍 MariaDB集群是MariaDB同步多主机集群.它仅支持XtraDB/ InnoDB存储引擎. 主要功能 同步复制 真正的multi-master,即所有节点可以同时读写数据库 ...
- Centos 7 下 Mysql 5.7 Galera Cluster 集群部署
一.介绍 传统架构的使用,一直被人们所诟病,因为MySQL的主从模式,天生的不能完全保证数据一致,很多大公司会花很大人力物力去解决这个问题,而效果却一般,可以说,只能是通过牺牲性能,来获得数据一致性 ...
- ansible roles实践 zookeeper集群部署
1.下载解压 wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11. ...
- Kubernetes集群部署关键知识总结
Kubernetes集群部署需要安装的组件东西很多,过程复杂,对服务器环境要求很苛刻,最好是能连外网的环境下安装,有些组件还需要连google服务器下载,这一点一般很难满足,因此最好是能提前下载好准备 ...
- Linux下MySQL/MariaDB Galera集群搭建过程【转】
MariaDB介绍 MariaDB是开源社区维护的一个MySQL分支,由MySQL的创始人Michael Widenius主导开发,采用GPL授权许可证. MariaDB的目的是完全兼容MySQL,包 ...
- [ Openstack ] Openstack-Mitaka 高可用之 Mariadb-Galera集群部署
目录 Openstack-Mitaka 高可用之 概述 Openstack-Mitaka 高可用之 环境初始化 Openstack-Mitaka 高可用之 Mariadb-Galera集群 ...
- Dubbo入门到精通学习笔记(二十):MyCat在MySQL主从复制的基础上实现读写分离、MyCat 集群部署(HAProxy + MyCat)、MyCat 高可用负载均衡集群Keepalived
文章目录 MyCat在MySQL主从复制的基础上实现读写分离 一.环境 二.依赖课程 三.MyCat 介绍 ( MyCat 官网:http://mycat.org.cn/ ) 四.MyCat 的安装 ...
- Shell脚本实现---Swarm集群部署实例(Swarm Cluster)
Shell脚本实现---Swarm集群部署实例(Swarm Cluster) 一.机器环境(均是centos7.8) IP hostname 角色 192.168.10.200 manager-swa ...
- openstack高可用集群21-生产环境高可用openstack集群部署记录
第一篇 集群概述 keepalived + haproxy +Rabbitmq集群+MariaDB Galera高可用集群 部署openstack时使用单个控制节点是非常危险的,这样就意味着单个节 ...
随机推荐
- http-runtime属性
配置httpRuntime也可以让FileUpload上传更大的文件,不过设置太大了会因用户将大量文件传递到该服务器而导致的拒绝服务攻击(属性有说明) 属性 属性 选项 说明 appRequestQu ...
- 在Hibernate中使用Memcached作为一个二级分布式缓存
转自:http://www.blogjava.net/xmatthew/archive/2008/08/20/223293.html hibernate-memcached--在Hibernate ...
- [转]十五天精通WCF——第九天 高级玩法之自定义Behavior
终于我又看完了二期爱情保卫战,太酸爽了,推荐链接:http://www.iqiyi.com/a_19rrgublqh.html?vfm=2008_aldbd,不多说,谁看谁入迷,下面言归正传, 看看这 ...
- PHP array_intersect_uassoc()
定义和用法 array_intersect_uassoc() 函数使用用户自定义的回调函数计算数组的交集,用回调函数比较索引. array_intersect_uassoc() 返回一个数组,该数组包 ...
- 大神note3千元指纹机,这是要逼疯友商吗
新发现(光山居士).7月20日下午.奇酷公司在北京奥雅会展中心召开公布会,宣布推出首款千元级别的指纹识别机大神Note3.据悉.该型号手机.移动版售价899元.全网通版售1099元,并在16:00開始 ...
- php file_get_contents遇到https的处理办法
最近调整了文件上传后的资源路径,导致pageOffice在线编辑功能无法正常使用,每一次打开文件都报错:该文件为0字节.仔细看了一下程序,整理逻辑流程如下图: 增加日志后发现,保存在服务器路径下的该条 ...
- linux各种IPC机制(进程通信)
linux各种IPC机制 (2011-07-08 16:58:35) 原文地址:linux各种IPC机制(转)作者:jianpengliu 原帖发表在IBM的developerworks网站 ...
- LeetCode60:Permutation Sequence
The set [1,2,3,-,n] contains a total of n! unique permutations. By listing and labeling all of the p ...
- java js url传参中文乱码
String item = this.getRequest().getParameter("item"); item = new String(item.getBytes(&quo ...
- C# winform KeyPress 事件中对应的数字
C# winform KeyPress 事件中对应的数字所有e.KeyChar值的意思 常用ASCII码表 你自己看看应该就明白了 键盘 ASCII码 键盘 ASCII码 ESC 27 7 55 S ...