Salt之CentOS7.5使用RPM包安装MySQL5.7.22
Posted minseo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Salt之CentOS7.5使用RPM包安装MySQL5.7.22相关的知识,希望对你有一定的参考价值。
手动安装参考CentOS7.5使用RPM包安装MySQL5.7.22
目录结构为
install.sls文件
#按顺序分别安装commin libs client server #避免冲突安装common前需要卸载mysql-libs mysql-common-install: file.managed: - name: /opt/mysql-community-common-5.7.22-1.el7.x86_64.rpm - source: salt://mysql/files/mysql-community-common-5.7.22-1.el7.x86_64.rpm - mode: 644 - user: root - group: root cmd.run: - name: cd /opt && yum -y remove mysql-libs && rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm mysql-libs-install: file.managed: - name: /opt/mysql-community-libs-5.7.22-1.el7.x86_64.rpm - source: salt://mysql/files/mysql-community-libs-5.7.22-1.el7.x86_64.rpm - mode: 644 - user: root - group: root cmd.run: - name: cd /opt && rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm mysql-client-install: file.managed: - name: /opt/mysql-community-client-5.7.22-1.el7.x86_64.rpm - source: salt://mysql/files/mysql-community-client-5.7.22-1.el7.x86_64.rpm - mode: 644 - user: root - group: root cmd.run: - name: cd /opt && rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm mysql-server-install: file.managed: - name: /opt/mysql-community-server-5.7.22-1.el7.x86_64.rpm - source: salt://mysql/files/mysql-community-server-5.7.22-1.el7.x86_64.rpm - mode: 644 - user: root - group: root cmd.run: - name: cd /opt && rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm && systemctl start mysqld && systemctl enable mysqld #依赖配置文件及bin-log配置 require: - file: mysql-config - file: /var/lib/mysql/mysql-bin-log/ #my.cnf配置文件 mysql-config: file.managed: - name: /etc/my.cnf - source: salt://mysql/files/my.cnf - mode: 644 - user: root - group: root #创建bin-log文件夹默认无该文件夹,不创建会导致mysql无法启动 /var/lib/mysql/mysql-bin-log/: file.directory: - mode: 755 - user: mysql - group: mysql - makedirs: True
配置文件my.cnf
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid #修改密码复制度要求只验证密码长度不验证密码复制度 validate_password_policy=LOW #bin-log日志设置 log-bin=/var/lib/mysql/mysql-bin-log/mysql-bin binlog_cache_size = 4M max_binlog_cache_size = 256M max_binlog_size = 32M binlog_format = row expire_logs_days = 7 server-id = 1
安装命令
salt ‘salt-test‘ state.sls mysql.install saltenv=prod
以上是关于Salt之CentOS7.5使用RPM包安装MySQL5.7.22的主要内容,如果未能解决你的问题,请参考以下文章
saltstack学习-简单部署之rhel5安装salt(不能联网)