码迷,mamicode.com
首页 > 数据库 > 详细

Salt之CentOS7.5使用RPM包安装MySQL5.7.22

时间:2019-05-20 13:20:10      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:cat   group   ant   pid   mysql-bin   sel   目录结构   password   bin   

  手动安装参考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

标签:cat   group   ant   pid   mysql-bin   sel   目录结构   password   bin   

原文地址:https://www.cnblogs.com/minseo/p/10893406.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!