Actual combat Use Saltstack source installation configuration MySQL

Source: Internet
Author: User
Tags openssl saltstack

Environment:

salt_master:192.168.100.228salt_client1:192.168.100.245
Master client version consistent [[email protected]_server base]# Salt--versions-report salt:0.17.5 python:2.6.6 (R2  66:84292, June, 14:18:47) Jinja2:unknown m2crypto:0.20.2 msgpack-python:0.1.13 Msgpack-pure:not Installed pycrypto:2.0.1 pyyaml:3.10 pyzmq:2.2.0.1 zmq:3.2.3[[email protected]_serv ER base]#

To begin installing the deployment files:

Top.sls file [[email protected]_server base]# cat Top.sls Base: ' salt_client* ':-Nginx[[email protected]_server base]#

Directory structure:

[Email protected]_server base]# Tree mysql/mysql/├──conf.sls├──files│├──conf.sh│├──my.cnf│├──mysql-5.5.22.t AR.GZ│├──MYSQLD│└──MYSQLLNS.SH├──INIT.SLS└──INSTALL.SLS1 directory, 8 files[[email protected]_server base]# [[em Ail protected]_server mysql]# cat Init.sls include:-Mysql.install-mysql.conf[[email protected]_server mysql]#

To install the master configuration file for MySQL:

[[email protected]_server mysql]# cat install.sls  #install  source  Mysqlmysql_source:  file.managed:    - name: /home/mysql-5.5.22.tar.gz     - unless: test -e /home/mysql-5.5.22.tar.gz     - source: salt://mysql/files/mysql-5.5.22.tar.gz#tar source mysqlextract_mysql:   cmd.run:    - cwd: /home    - names:         - tar xf mysql-5.5.22.tar.gz         - chown root:root /home/mysql-5.5.22 -r    -  unless: test -d /home/mysql-5.5.22    - require:         - file: mysql_source#useradd for mysqlmysql_user:   user.present:    - name: mysql    - uid: 1024    -  createhome: false    - gid_from_name: true    -  shell: /sbin/nologin#mysql pkg.installmysql_pkg:  pkg.installed:    -  pkgs:      - gcc      - gcc-c++       - autoconf      - automake       - openssl      - openssl-devel       - zlib      - zlib-devel       - ncurses-devel      - libtool-ltdl-devel       - cmake#mysql source installmysql_commpile:   cmd.run:    - cwd: /home/mysql-5.5.22    - names:         - cmake -dcmake_install_prefix=/usr/local/mysql -dmysql_datadir=/usr/local/mysql/data  -ddefault_charset=utf8  -ddefault_collatton=utf8_cuicode_ci   -dwith_readline=1  -dwith_ssl=system -dwith_embedded_server=1  -denabled_local_infile=1 -ddefault_ collation=utf8_general_ci -dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 - dwith_debug=0        - make         - make install    - require:         - cmd.run: extract_mysql        - pkg : mysql_pkg    - unless: test -d /usr/local/mysql[[email  protected]_server mysql]#


MySQL config file:

[[email protected]_server mysql]# cat conf.sls include:  -  mysql.install# mysql for configmysql_cnf:  file.managed:    -  name: /etc/my.cnf    - user: root    - mode:  755    - source: salt://mysql/files/my.cnf# mysql initsalt:// mysql/files/conf.sh:  cmd.script:      - env:           - BATCH:  ' yes '       -  require:          - cmd.run: mysql_commpile           - pkg: mysql_pkg # mysql  Servermysql_service:   file.managed:     - name: /etc/init.d /mysqld     - user: root     - mode: 755     -  Source: salt://mysql/files/mysqld   cmd.run:     - names:          - /sbin/chkconfig --add mysqld          - /sbin/chkconfig --level 35 mysqld  on     - unless: /sbin/chkconfig --list mysqld    service.running:     - name: mysqld     -  enable: true     - reload: true[[email protected]_server  mysql]#

Configuration file:

[[email protected]_server mysql]# tree files/files/├── conf.sh Initialization file ├──  MY.CNF configuration file ├── mysql-5.5.22.tar.gz installation package ├── mysqld startup script └── mysqllns.sh Soft connection 0 directories, 5  files[[email protected]_server mysql]# [[email protected]_server mysql]#  cat files/conf.sh #!/bin/bash/usr/local/mysql/scripts/mysql_install_db --user=mysql -- basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/[[email protected]_server mysql]#  cat files/mysqllns.sh #!/bin/bash#lnsln -sv /usr/local/mysql/bin/mysql /usr/bin  ln -sv /usr/local/mysql/bin/mysqladmin /usr/bin/ln -sv /usr/local/mysql/bin/ mysqldump /usr/bin/#mysq  competence/bin/chown -R mysql.mysql /usr/local/mysql/  && /bin/chown -r mysql.mysql /usr/local/mysql/data/[[email protected]_server  mysql]#


This article is from the "Angerdevil" blog, make sure to keep this source http://devliangel.blog.51cto.com/469347/1547824

Actual combat Use Saltstack source installation configuration MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.