关闭

利用openstack建设适合中小型互联网企业的私有云(五)

标签: Openstack云平台私有云
5782人阅读 评论(0) 收藏 举报
分类:

安装openstack环境包,配置mariadb数据库高可用:

一、安装openstack环境包

控制节点controller1和controller2:

yum install centos-release-openstack-liberty -y
yum upgrade -y
yum install python-openstackclient openstack-selinux memcached python-memcached cifs-utils quota psmisc pcs pacemaker corosync fence-agents-all resource-agents -y
systemctl enable memcached.service
systemctl start memcached.service

计算节点compute1:

yum install centos-release-openstack-liberty -y
yum upgrade -y
yum install python-openstackclient openstack-selinux -y

二、配置mariadb数据库高可用

控制节点controller1:

cat <<EOF> /etc/my.cnf.d/galera.cnf
[mysqld]
user=mysql
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
wsrep_on=1
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=1G"
wsrep_cluster_name="openstack_mysql"
wsrep_cluster_address="gcomm://192.168.101.3"
wsrep_node_name='controller1'
wsrep_node_address='192.168.101.4'
wsrep_slave_threads=1
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=
wsrep_sst_method=rsync
EOF
sed -i '/Group=mysql/a\LimitNOFILE=10000\nLimitNPROC=10000' /usr/lib/systemd/system/mariadb.service
systemctl --system daemon-reload
systemctl enable mariadb.service
mysql_install_db --user=mysql
/usr/libexec/mysqld  --wsrep-new-cluster &
mysql_secure_installation    #设置root密码,其他选Y
控制节点controller2:

cat <<EOF> /etc/my.cnf.d/galera.cnf
[mysqld]
user=mysql
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
wsrep_on=1
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=1G"
wsrep_cluster_name="openstack_mysql"
wsrep_cluster_address="gcomm://192.168.101.4"
wsrep_node_name='controller2'
wsrep_node_address='192.168.101.3'
wsrep_slave_threads=1
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=
wsrep_sst_method=rsync
EOF
sed -i '/Group=mysql/a\LimitNOFILE=10000\nLimitNPROC=10000' /usr/lib/systemd/system/mariadb.service
systemctl --system daemon-reload
systemctl enable mariadb.service
systemctl start mariadb.service

控制节点controller1:

killall mysqld && systemctl restart mariadb.service

验证:
# mysql -u root -p111111 -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 2     |
+--------------------+-------+

出现如上即完成mariadb数据库高可用配置


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:375971次
    • 积分:4394
    • 等级:
    • 排名:第7084名
    • 原创:84篇
    • 转载:1篇
    • 译文:1篇
    • 评论:17条
    文章分类
    最新评论