saltstack安装mysql_saltstack 安装mysql

本文介绍使用SaltStack自动化工具部署MySQL数据库的过程。通过SaltStack的状态管理文件实现MySQL的安装配置及初始化,包括创建用户、设置路径、下载源码包、安装依赖软件包、编译安装MySQL等步骤。
摘要由CSDN通过智能技术生成

[root@qing mysql]# cat init.sls

include:

- mysql.install

- mysql.config

[root@qing mysql]# cat install.sls

mysql_user:

user.present:

- name: mysql

- shell: /sbin/login

mysql_path:

file.directory:

- name: /usr/local/webserver/mysql/

- user: mysql

- group: mysql

- dir_mode: 755

- makidrs: True

- recurse:

- user

- group

- mode

mysql_trans:

file.managed:

- source: salt://mysql/files/mysql-5.5.15.tar.gz

- name: /tmp/mysql-5.5.15.tar.gz

- mode: 755

- unless: test -e /tmp/mysql-5.5.15.tar.gz

mysql_cmake:

pkg.installed:

- names:

- cmake

- ncurses-devel

- bison

- automake

- autoconf

- ncurses

- ncurses-*

cmd.run:

- cwd: /tmp/

- name: tar zxpf /tmp/mysql-5.5.15.tar.gz

mysql_install:

cmd.run:

- cwd: /tmp/mysql-5.5.15

- names:

- cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -Wno-dev

- make

- make install

[root@qing mysql]# cat config.sls

mysql_peizhi:

cmd.run:

- names:

- chown -R mysql:mysql /usr/local/webserver/mysql

- ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

- cp /usr/local/webserver/mysql/support-files/my-large.cnf /etc/my.cnf

- cp /usr/local/webserver/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

- /sbin/chkconfig --add mysqld

- /sbin/chkconfig mysqld on

- /usr/local/webserver/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql/  --datadir=/var/lib/mysql/

[root@qing mysql]# tree files/

files/

+-- mysql-5.5.15.tar.gz

0 directories, 1 file

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值