Saltstack in-depth-test saltstack configuration Zabbix required Mysql-server

Source: Internet
Author: User
Tags percona saltstack

Saltstack in-depth-test saltstack configuration Zabbix required Mysql-server

Operation content: First, basic Environment 1, use Tvm-cobbler to install a Tvm-zabbix virtual machine to do the experiment. 2, Network: eth0:host-only (for virtual intranet, manually fixed IP, so from the host can directly connect to this VM) Eth1:nat (for Sisu network, dynamic IP) [[email protected] ~]#  cd /etc/sysconfig/network-scripts/[[email protected] network-scripts]# cat  ifcfg-eth0device=eth0type=ethernetonboot=yesnm_controlled=yesbootproto=noneipaddr=192.168.56.200prefix= 24gateway=192.168.56.1dns1=192.168.56.254[[email protected] network-scripts]# cat  ifcfg-eth1device=eth1type=ethernetonboot=yesnm_controlled=yesbootproto=dhcpdns1=192.168.56.254[[email  protected] ~]# df -hfilesystem      size  used  avail use% mounted on/dev/sda3        36g   1.8g   32g   6% /tmpfs            499m   12k  499m   1% /dev/shm/dev/sda1 &nBsp;     194m   29m  155m  16% /boot/dev/sdb1         99g  188m   94g   1%  /data using the domain name:[[email protected] ~]# cat /etc/dnsmasq.d/office.conf |grep  zbx-maddress=/zbx-m.office.test/192.168.56.2003, repo we have added several RPM packages in our own office repo: [[email protected]  data]# yum search --disablerepo=\* --enablerepo=office perconaLoaded  plugins: fastestmirror, securityloading mirror speeds from cached hostfile= ====================================================================================== n/s matched:  percona ======================================================================================= percona-server-55-debuginfo.x86_64 : debug information for package  percona-server-55percona-server-client-55.x86_64 : percona server - clientpercona-server-devel-55.x86_64 : percona  Server - Development header files and  Librariespercona-server-server-55.x86_64 : percona server: a very fast and  reliable SQL database serverPercona-Server-shared-55.x86_64 : Percona  server - shared librariespercona-server-test-55.x86_64 : percona server -  test suitepercona-zabbix-templates.noarch : percona monitoring plugins for  Zabbix  Name and summary matches only, use  "Search all"  for everything. Ii. configuration 1, SLS file [[email protected] base]# cat mysql/server.sls     ##  installation of Mysql-server, and corresponding Zabbix monitoring related files. # # via pc @ 2015/8/12percona-server:  pkg.installed:## for  local-ofFice.repo#    - fromrepo: office,base,repo    - name:  zabbix-agent    - skip_verify: true    - refresh:  True    - pkgs:## for percona-server#             - Percona-Server-55-debuginfo       - Percona-Server-client-55      - Percona-Server-devel-55       - Percona-Server-server-55      -  percona-server-shared-55      - percona-server-test-55       - percona-zabbix-templates## for zabbix# scripts are installed  to /var/lib/zabbix/percona/scripts# templates are installed to /var/lib/ Zabbix/percona/templates## /var/lib/zabbix/percona/scripts:# total 64# -rwxr-xr-x 1 root root   1251 jul 21  2014 get_mysql_stats_wrapper.sh# -rwxr-xr-x 1 root  root 58226 jul 21  2014 ss_get_mysql_stats.php## /var/lib/zabbix/percona/ Templates:# total 284# -rw-r--r-- 1 root root  18866 jul 21   2014 userparameter_percona_mysql.conf# -rw-r--r-- 1 root root 269258  jul 21  2014 zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.4.xml#        - php      - php-mysql/etc/ my.cnf:  file.managed:    - source: salt://conf.d/mysql/my.cnf     - mode: 644    - require:       - pkg: percona-server/data/mysql:  file.directory:    - user: mysql     - group: mysql    - mode: 755     - makedirs: true    - require:      -  pkg: percona-serverrun-mysql:## installing mysql system tables# please  remember to set a password for the mysql root user !#  /usr/bin/mysqladmin -u root password  ' New-password '   cmd.run:     - name: /usr/bin/mysql_install_db    - onlyif:       - d_mysql=$ (grep  ' datadir '  /etc/my.cnf |cut -d ' = '  -f2);         d_mysql_install= "${d_mysql}/mysql";         test !&nBsp;-d ${d_mysql_install}  service.running:    - name: mysql     - enable: True    - require:       - pkg: Percona-Server## for zabbixpercona_zabbix_php:   File.managed:    - name: /etc/php.ini    - source:  salt://conf.d/mysql/percona_zabbix_php.ini    - mode: 755     - require:      - pkg: percona-server## for  zabbix# notice! password need to be protected in file: ss_ get_mysql_stats.phpss_get_mysql_stats:  file.managed:    - name: /var/ lib/zabbix/percona/scripts/ss_get_mysql_stats.php    - source: salt://conf.d/ mysql/ss_get_mysql_stats.php    - mode: 770    - require:      -  Pkg: percona-server2, conf file [[email protected] base]# tree conf.d/mysql/conf.d/mysql/ ├── my.cnf├── percona_zabbix_php.ini└── ss_get_mysql_stats.php0 directories, 3  Files[[email protected] base]# cat conf.d/mysql/my.cnf [mysqld]# generaldatadir= /data/mysqlsocket=/data/mysql/mysql.sockpid_file=/data/mysql/mysqld.piduser=mysqlport=3306#enforce_storage_ Engine=innodbdefault-storage-engine=innodbcharacter_set_server=utf8# innodbinnodb_buffer_pool_size= 2ginnodb_flush_method=o_directinnodb_file_per_table=1innodb_open_files=500innodb_log_buffer_size=128minnodb_ Log_file_size=256minnodb_stats_on_metadata=offinnodb_support_xa=offinnodb_thread_concurrency=0innodb_io_ capacity=200# myisamkey_buffer_size=128m#binlogserver_id=10log_bin=/data/mysql/mysql-binbinlog_format= Mixed#replicate-do-db=cdn#replicaTe-ignore-db=mysql#replicate-ignore-db=test#relay_log=/data/mysql/relay-log# logginglog_error=/data/mysql /mysql-error.logslow_query_log=onlong_query_time=2slow_query_log_file=/data/mysql/mysql-slow# #These  two  variables are only for perconamax_slowlog_files=5max_slowlog_size=100mexpire_logs_ Days=14# othertmp_table_size=32mmax_heap_table_size=32mopen_files_limit=600000query_cache_type=0query_ Cache_size=0thread_cache_size=64table_definition_cache=500table_open_cache=1000max_allowed_packet=16mmax_ Connections=800max_user_connections=400max_connect_errors=99999999skip_name_resolve[client]default_character_ Set=utf8socket=/data/mysql/mysql.sock other 2 files, mainly MySQL related configuration to adjust: [[Email protected] base]# grep   ' Mysql.sock '  conf.d/mysql/percona_zabbix_php.ini mysql.default_socket = /data/mysql/ mysql.sockmysqli.default_socket = /data/mysql/mysql.sock[[email protected] base]#  grep -e  ' ^\ $mysql _ (U|p) '  conf.d/mysql/ss_get_mysql_stats.php  $mysql _user =  ' Zabbix_ro '; $mysql _pass =   ' xxx '; $mysql _port = 3306; three, execute [[email protected] base]# salt  ' Tvm-zabbix '  state.sls mysql.server --output-file= '/tmp/salt.log '   iv. precautions if we're in another shell, The debug log for Salt-minion is turned on, and at the same time our salt-minion service is not over, there are multiple salt-minion:[[email protected] data]#  salt-minion -l debug[[email protected] ~]# ps -ef |grep saltroot      31623     1  0 16:45 ?         00:00:01 /usr/bin/python2.6 /usr/bin/salt-minion -droot      31882  1205  0 17:04 pts/0     00:00:00 /usr/bin/python2.6 /usr/bin/salt-minion -l debugroot      31885 31882  1 17:04 Pts/0    00:00:00 /usr/bin/python2.6 /usr/bin/salt-minion -l debugroot      32083 29908  0 17:05 pts/1     00:00:00 grep salt, the following exception may occur on the Salt command on salt-master: [[[Email protected] base]# salt   ' Tvm-zabbix '  state.sls mysql.server --output-file= '/tmp/salt.log '  [[email  Protected] base]# cat /tmp/salt.log tvm-zabbix:    data failed  to compile:----------    The function  "State.sls"  is  running as pid 32031 and was started at 2015, aug 12  17:04:42.900197 WITH JID 20150812170442900197 Therefore, the recommended practice is to first close the Monit and salt-minion services, Then manually start the debug mode of the Salt-minion service: service monit stopservice salt-minion stopsalt-minion -l  DEBUGZYXW, reference 1, the boss to provide information.


Saltstack in-depth-test saltstack configuration Zabbix required Mysql-server

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.