找到相应版本的安装包下载

作者: www.9159.com  发布:2019-09-21

 

  1. Install Xvfb and dependencies:
  • gitlab是什么?

Preface

    1) sudo yum -y install firefox Xvfb libXfont Xorg

GitLab includes Git repository management, code reviews, issue tracking, wikis, and more, plus GitLab CI, an easy-to-use continuous integration and deployment tool.

Overview

rabbitmq-server is included in Fedora. However, the versions included are often quite old. You will probably get better results installing the .rpm from our website. Check the Fedora package details for which version of the server is available for which versions of the distribution.

We also upload our RPM packages to PackageCloud and Bintray.

 

    2) yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"

gitlab我们主要用来代码托管、code review。

Supported Distributions

Below is a list of supported RPM-based distributions as of RabbitMQ 3.6.3:

  • CentOS 6.x and 7.x (note: there are two separate RPM packages for 6.x and 7.x)
  • RedHat Enterprise Linux 6.x and 7.x (same as for CentOS, there are two separate packages)
  • Fedora 23 through 25 (use the RHEL 7.x package)

The packages may work on other RPM-based distributions if dependencies (see below) are satisfied (e.g. using the Wheezy backports repository) but their testing and support is done on a best effort basis.

 

    MasterHA is a tool which can be used in MySQL HA architecture.I'm gonna implement it and have some tests depend on it later.

  1. Download and install chrome
  • ubuntu如何安装gitlab
    1. Install and configure the necessary dependencies

Install Erlang

Before installing RabbitMQ, you must install a supported version of Erlang/OTP. We strongly recommend using a packaged version. There are three suggested sources for Erlang packages:

  • We produce a package stripped down to only provide those components needed to run RabbitMQ. It may not be as up to date as Erlang Solutions' packages, but it might be easiest to use if installing Erlang's dependencies is proving difficult.
  • Erlang Solutions produces packages that are usually up to date. They produce two sets of packages - ones which are split up and are more convenient to use if you can add a yum repository, and a monolithic package which might be easier if you have to download manually.
  • EPEL ("Extra Packages for Enterprise Linux"); part of the Red Hat / Fedora organisation, provides many additional packages, including Erlang. These are the most official packages, and are split into many small packages, but are not always up to date.

 

    1) wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

Install zero-dependency Erlang from RabbitMQ

  1. Download and install the zero dependency Erlang RPM package for running RabbitMQ. As the name suggests, the package strips off some Erlang modules and dependencies that are not essential for running RabbitMQ.

Framework

    2) sudo yum install ./google-chrome-stable_current_*.rpm

sudo apt-get install curl openssh-server ca-certificates postfix

Install Erlang from the EPEL repository or

  1. Follow the steps in the EPEL FAQ to enable EPEL on your machine.
  2. Issue the following command as 'root':

    yum install erlang
    

 

  1. Configure Xvfb
  1. Add the GitLab package server and install the package

Install Erlang from the Erlang Solutions repository or

  1. Follow the instructions under "Installation using repository" at Erlang Solutions.
Hostname IP Port Identity OS Version MySQL Version
zlm2 192.168.1.101 3306 master CentOS 7.0 5.7.21
zlm3 192.168.1.102 3306 slave/mha-manager CentOS 7.0 5.7.21
null 192.168.1.200 null vip null null

    1) vi /etc/init.d/Xvfb, paste the Xvfb script with following contents: refer to the bottom of the page

Install monolithic Erlang from Erlang Solutions or

  1. Download and install the appropriate esl-erlang RPM from Erlang Solutions.
  2. Download and install the esl-erlang-compat RPM (direct download) produced by Jason McIntosh.

    This is needed since Erlang Solutions' monolithic packages provide "esl-erlang"; this package just requires "esl-erlang" and provides "erlang".

 

    2) Modify the script access

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

Install RabbitMQ Server

Procedure

        (1) chmod +x /etc/init.d/Xvfb

如果这一步无法完成,则去

With rpm and Downloaded RPM

After downloading the server package, issue the following command as 'root':

rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
        yum install rabbitmq-server-3.6.9-1.noarch.rpm

Our public signing key is also available from Bintray.

 

        (2) chkconfig Xvfb on

https://packages.gitlab.com/gitlab/gitlab-ce

Using PackageCloud RPM Repository

PackageCloud installs packages via HTTPS and signs them using their GPG key. There are multiple ways to install:

  • Provided installation scripts
  • Using PackageCloud Chef cookbook
  • Using PackageCloud Puppet module
  • Manually

See PackageCloud RabbitMQ repository instructions.

 

Downlaod the rpm package of MasterHA using below web link first:

        (3) service Xvfb start

找到相应版本的安装包下载

Run RabbitMQ Server

Customise RabbitMQ Environment Variables
The server should start using defaults. You can customise the RabbitMQ environment. Also see how to configure components.

Start the Server
The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the daemon by default when the system boots, as an administrator runchkconfig rabbitmq-server on.

As an administrator, start and stop the server as usual using /sbin/service rabbitmq-server stop/start/etc.

Note: The server is set up to run as system user rabbitmq. If you change the location of the Mnesia database or the logs, you must ensure the files are owned by this user (and also update the environment variables).

https://code.google.com/archive/p/mysql-master-ha/downloads

    3) Configure DISPLAY environment variable in jenkins:

curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/trusty/gitlab-ce-XXX.deb/download
dpkg -i gitlab-ce-XXX.deb

Port Access

SELinux, and similar mechanisms may prevent RabbitMQ from binding to a port. When that happens, RabbitMQ will fail to start. Firewalls can prevent nodes and CLI tools from communicating with each other. Make sure the following ports can be opened:

  • 4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools
  • 5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS
  • 25672: used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.
  • 15672: HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)
  • 61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled)
  • 1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled
  • 15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)
  • 15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)

It is possible to configure RabbitMQ to use different ports and specific network interfaces.

 

MasterHA's wiki document.

*        (1) Manage Jenkins -> Configure System -> Global Properties -> Environment Variables*

  1. Configure and start GitLab

Default user access

The broker creates a user guest with password guest. Unconfigured clients will in general use these credentials. By default, these credentials can only be used when connecting to the broker as localhost so you will need to take action before connecting from any other machine.

See the documentation on access control for information on how to create more users, delete the guestuser, or allow remote access to the guest user.

https://github.com/yoshinorim/mha4mysql-manager/wiki

*        (2) Add a variable: name=DISPLAY, value=:7*

Controlling System Limits on Linux

RabbitMQ installations running production workloads may need system limits and kernel parameters tuning in order to handle a decent number of concurrent connections and queues. The main setting that needs adjustment is the max number of open files, also known as ulimit -n. The default value on many operating systems is too low for a messaging broker (eg. 1024 on several Linux distributions). We recommend allowing for at least 65536 file descriptors for user rabbitmq in production environments. 4096 should be sufficient for most development workloads.

There are two limits in play: the maximum number of open files the OS kernel allows (fs.file-max) and the per-user limit (ulimit -n). The former must be higher than the latter.

On distributions that use systemd, the OS limits are controlled via a configuration file at /etc/systemd/system/rabbitmq-server.service.d/limits.conf, for example:

[Service]
LimitNOFILE=300000

 

The most straightforward way to adjust the per-user limit for RabbitMQ on distributions that do not use systemd is to edit the rabbitmq-env.conf to invoke ulimit before the service is started.

ulimit -S -n 4096

 

This soft limit cannot go higher than the hard limit (which defaults to 4096 in many distributions). The hard limit can be increased via /etc/security/limits.conf. This also requires enabling the pam_limits.somodule and re-login or reboot.

Note that limits cannot be changed for running OS processes.

For more information about controlling fs.file-max with sysctl, please refer to the excellent Riak guide on open file limit tuning.

 

    4) (Optional) Try run: google-chrome &Ignore the error message:Xlib:extension "RANDR" missing on display ":7".

sudo gitlab-ctl reconfigure

Verifying the Limit

RabbitMQ management UI displays the number of file descriptors available for it to use on the Overview tab.

rabbitmqctl status

includes the same value.

 

The following command

cat /proc/$RABBITMQ_BEAM_PROCESS_PID/limits

can be used to display effective limits of a running process. $RABBITMQ_BEAM_PROCESS_PID is the OS PID of the Erlang VM running RabbitMQ, as returned by rabbitmqctl status.

 

Configure ssh authentication between zlm2 and zlm3 from each other.

  1. Start selenium server
  1. Browse to the hostname and login
    初始化密码

Configuration Management Tools

Configuration management tools (e.g. Chef, Puppet, BOSH) provide assistance with system limit tuning. Our developer tools guide lists relevant modules and projects.

 1 [root@zlm2 09:00:44 ~]
 2 #ssh-keygen -t rsa
 3 Generating public/private rsa key pair.
 4 Enter file in which to save the key (/root/.ssh/id_rsa): 
 5 Enter passphrase (empty for no passphrase): 
 6 Enter same passphrase again: 
 7 Your identification has been saved in /root/.ssh/id_rsa.
 8 Your public key has been saved in /root/.ssh/id_rsa.pub.
 9 The key fingerprint is:
10 48:36:15:af:d7:97:3c:94:f3:0e:bc:ea:34:f1:bc:43 root@zlm2
11 The key's randomart image is:
12 +--[ RSA 2048]----+
13 |        o.       |
14 |       . .     . |
15 |      +   .   +  |
16 |     o o . . + + |
17 |      . S . o B .|
18 |         .   =E= |
19 |            o.+ .|
20 |           . o.. |
21 |           .o .. |
22 +-----------------+
23 
24 [root@zlm2 09:03:04 ~]
25 #cd .ssh
26 
27 [root@zlm2 09:03:09 ~/.ssh]
28 #ls -l
29 total 12
30 -rw------- 1 root root 1675 Aug  2 09:02 id_rsa
31 -rw-r--r-- 1 root root  391 Aug  2 09:02 id_rsa.pub
32 -rw-r--r-- 1 root root  360 Jun 13 09:51 known_hosts
33 
34 [root@zlm2 09:03:18 ~/.ssh]
35 #cat id_rsa.pub >> authorized_keys
36 
37 [root@zlm2 09:07:51 ~/.ssh]
38 #scp ./* zlm3:~/.ssh/
39 root@zlm3's password: 
40 authorized_keys                                                                                                    100%  391     0.4KB/s   00:00    
41 id_rsa                                                                                                             100% 1675     1.6KB/s   00:00    
42 id_rsa.pub                                                                                                         100%  391     0.4KB/s   00:00    
43 known_hosts                                                                                                        100%  360     0.4KB/s   00:00
44 
45 [root@zlm2 09:08:22 ~/.ssh]
46 #ssh zlm3
47 Last login: Thu Aug  2 08:47:54 2018 from 192.168.1.1
48 Welcome to your Vagrant-built virtual machine.
49 
50 [root@zlm3 09:10:39 ~]
51 #
52 
53 [root@zlm3 09:11:13 ~/.ssh]
54 #ssh zlm2
55 The authenticity of host 'zlm2 (192.168.1.101)' can't be established.
56 ECDSA key fingerprint is 75:06:22:b7:e2:3b:46:88:51:97:c4:4f:27:20:21:26.
57 Are you sure you want to continue connecting (yes/no)? yes
58 Warning: Permanently added 'zlm2,192.168.1.101' (ECDSA) to the list of known hosts.
59 Last login: Thu Aug  2 03:29:04 2018 from 192.168.1.1
60 Welcome to your Vagrant-built virtual machine.
61 
62 [root@zlm2 09:11:22 ~]
63 #

    1) In GCP terminal: cd to the selenium jar folder

https://about.gitlab.com/downloads/#ubuntu1404

Managing the Broker

To stop the server or check its status, etc., you can use package-specific scripts (e.g. the service tool) or invoke rabbitmqctl (as an administrator). It should be available on the path. All rabbitmqctl commands will report the node absence if no broker is running.

  • Invoke rabbitmqctl stop to stop the server.
  • Invoke rabbitmqctl status to check whether it is running.

More info on rabbitmqctl.

 

    2) nohup java -jar ./lib/selenium-server-standalone-3.0.1.jar &

Logging

Output from the server is sent to a RABBITMQ_NODENAME.log file in the RABBITMQ_LOG_BASE directory. Additional log data is written to RABBITMQ_NODENAME-sasl.log.

The broker always appends to the log files, so a complete log history is retained.

You can use the logrotate program to do all necessary rotation and compression, and you can change it. By default, this script runs weekly on files located in default /var/log/rabbitmq directory. See/etc/logrotate.d/rabbitmq-server to configure logrotate.

**Configure a master-slave replication.**

    3) Check the selenium server started status: ps -aux | grep java

 

    4) Add Peggy URL as jenkins env, same as configure the DISPLAY in 4.3eg. For shareDev,PeggyURL=https://project-7192975833413718180.firebaseapp.com

  1 [root@zlm2 09:18:30 ~]
  2 #scp db3306_20180802.sql zlm3:~/
  3 db3306_20180802.sql                                                                                                100% 8429KB   8.2MB/s   00:00
  4 
  5 [root@zlm3 09:19:55 ~]
  6 #mysql < db3306_20180802.sql 
  7 ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
  8 
  9 [root@zlm3 09:20:00 ~]
 10 #mysql
 11 Welcome to the MySQL monitor.  Commands end with ; or g.
 12 Your MySQL connection id is 3
 13 Server version: 5.7.21-log MySQL Community Server (GPL)
 14 
 15 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 16 
 17 Oracle is a registered trademark of Oracle Corporation and/or its
 18 affiliates. Other names may be trademarks of their respective
 19 owners.
 20 
 21 Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
 22 
 23 (zlm@192.168.1.102 3306)[(none)]>reset master;
 24 Query OK, 0 rows affected (0.03 sec)
 25 
 26 (zlm@192.168.1.102 3306)[(none)]>exit
 27 Bye
 28 
 29 [root@zlm3 09:20:28 ~]
 30 #mysql < db3306_20180802.sql
 31 
 32 [root@zlm3 09:20:34 ~]
 33 #mysql
 34 Welcome to the MySQL monitor.  Commands end with ; or g.
 35 Your MySQL connection id is 5
 36 Server version: 5.7.21-log MySQL Community Server (GPL)
 37 
 38 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 39 
 40 Oracle is a registered trademark of Oracle Corporation and/or its
 41 affiliates. Other names may be trademarks of their respective
 42 owners.
 43 
 44 Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
 45 
 46 (zlm@192.168.1.102 3306)[(none)]>change master to 
 47     -> master_host='192.168.1.101',
 48     -> master_port=3306,
 49     -> master_user='repl',
 50     -> master_password='repl4slave',
 51     -> master_auto_position=1;
 52 Query OK, 0 rows affected, 2 warnings (0.02 sec)
 53 
 54 (zlm@192.168.1.102 3306)[(none)]>start slave;
 55 Query OK, 0 rows affected (0.00 sec)
 56 
 57 (zlm@192.168.1.102 3306)[(none)]>show slave statusG
 58 *************************** 1. row ***************************
 59                Slave_IO_State: Waiting for master to send event
 60                   Master_Host: 192.168.1.101
 61                   Master_User: repl
 62                   Master_Port: 3306
 63                 Connect_Retry: 60
 64               Master_Log_File: mysql-bin.000048
 65           Read_Master_Log_Pos: 736
 66                Relay_Log_File: relay-bin.000002
 67                 Relay_Log_Pos: 398
 68         Relay_Master_Log_File: mysql-bin.000048
 69              Slave_IO_Running: Yes
 70             Slave_SQL_Running: Yes
 71               Replicate_Do_DB: 
 72           Replicate_Ignore_DB: 
 73            Replicate_Do_Table: 
 74        Replicate_Ignore_Table: 
 75       Replicate_Wild_Do_Table: 
 76   Replicate_Wild_Ignore_Table: 
 77                    Last_Errno: 0
 78                    Last_Error: 
 79                  Skip_Counter: 0
 80           Exec_Master_Log_Pos: 736
 81               Relay_Log_Space: 591
 82               Until_Condition: None
 83                Until_Log_File: 
 84                 Until_Log_Pos: 0
 85            Master_SSL_Allowed: No
 86            Master_SSL_CA_File: 
 87            Master_SSL_CA_Path: 
 88               Master_SSL_Cert: 
 89             Master_SSL_Cipher: 
 90                Master_SSL_Key: 
 91         Seconds_Behind_Master: 0
 92 Master_SSL_Verify_Server_Cert: No
 93                 Last_IO_Errno: 0
 94                 Last_IO_Error: 
 95                Last_SQL_Errno: 0
 96                Last_SQL_Error: 
 97   Replicate_Ignore_Server_Ids: 
 98              Master_Server_Id: 1013306
 99                   Master_UUID: 1b7181ee-6eaf-11e8-998e-080027de0e0e
100              Master_Info_File: mysql.slave_master_info
101                     SQL_Delay: 0
102           SQL_Remaining_Delay: NULL
103       Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
104            Master_Retry_Count: 86400
105                   Master_Bind: 
106       Last_IO_Error_Timestamp: 
107      Last_SQL_Error_Timestamp: 
108                Master_SSL_Crl: 
109            Master_SSL_Crlpath: 
110            Retrieved_Gtid_Set: 
111             Executed_Gtid_Set: 1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730247
112                 Auto_Position: 1
113          Replicate_Rewrite_DB: 
114                  Channel_Name: 
115            Master_TLS_Version: 
116 1 row in set (0.00 sec)
  1. Update job script

 

    1) Replace peggy URL in config.xml withhttps://${PEGGYURL}.firebaseapp.com

Install dependency packge first.

    2) Replace firebase DB secret in FirebaseUtils.java with${FIREBASE_DB_SECRET}

 1 [root@zlm2 09:32:28 ~]
 2 #yum install -y perl-Time-HiRes perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager
 3 
 4 [root@zlm2 09:33:56 ~]
 5 #ssh zlm3
 6 Last login: Thu Aug  2 09:10:39 2018 from 192.168.1.101
 7 Welcome to your Vagrant-built virtual machine.
 8 
 9 [root@zlm3 09:34:03 ~]
10 #yum install -y perl-Time-HiRes perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager

    3) Configure slack channel

 

  1. Add post action script for slack notification

Install both manager and node rpm on master and slave.

    1) Refer to the setting:https://wiki.jenkins-ci.org/display/JENKINS/Slack+Plugin

 1 [root@zlm2 09:39:08 ~]
 2 #rpm -ivh mha4mysql-manager-0.56-0.el6.noarch.rpm 
 3 error: Failed dependencies:
 4     mha4mysql-node >= 0.54 is needed by mha4mysql-manager-0.56-0.el6.noarch
 5     perl(MHA::BinlogManager) is needed by mha4mysql-manager-0.56-0.el6.noarch
 6     perl(MHA::NodeConst) is needed by mha4mysql-manager-0.56-0.el6.noarch
 7     perl(MHA::NodeUtil) is needed by mha4mysql-manager-0.56-0.el6.noarch
 8     perl(MHA::SlaveUtil) is needed by mha4mysql-manager-0.56-0.el6.noarch
 9 
10 [root@zlm2 09:39:16 ~]
11 #rpm -ivh mha4mysql-node-0.56-0.el6.noarch.rpm 
12 Preparing...                          ################################# [100%]
13 Updating / installing...
14    1:mha4mysql-node-0.56-0.el6        ################################# [100%]
15 
16 [root@zlm2 09:39:48 ~]
17 #rpm -ivh mha4mysql-manager-0.56-0.el6.noarch.rpm 
18 Preparing...                          ################################# [100%]
19 Updating / installing...
20    1:mha4mysql-manager-0.56-0.el6     ################################# [100%]
21    
22 [root@zlm2 09:39:53 ~]
23 #ssh zlm3
24 Last login: Thu Aug  2 09:34:03 2018 from 192.168.1.101
25 Welcome to your Vagrant-built virtual machine.
26 
27 [root@zlm3 09:41:46 ~]
28 #rpm -ivh mha4mysql-node-0.56-0.el6.noarch.rpm
29 Preparing...                          ################################# [100%]
30 Updating / installing...
31    1:mha4mysql-node-0.56-0.el6        ################################# [100%]
32 
33 [root@zlm3 09:42:03 ~]
34 #rpm -ivh mha4mysql-manager-0.56-0.el6.noarch.rpm
35 Preparing...                          ################################# [100%]
36 Updating / installing...
37    1:mha4mysql-manager-0.56-0.el6     ################################# [100%]   

    2) Custom message: "Job '${JOB_NAME} [${BUILD_NUMBER}]' (${BUILD_URL})"

 

    3) Other notification parameters refer to the "Jenkins”->“Manage Jenkins”->“Configure System”->”Global Slack Notifier Settings"

Configure the conf files on each manager node.

    4) Set job build trigger as ‘Projects to watch’ = ‘business-os/pwc-fso-larson-web-client/master’, trigger when stable

 1 [root@zlm2 09:48:22 ~]
 2 #mkdir -p /var/log/masterha/app1
 3 
 4 [root@zlm2 09:48:28 ~]
 5 #mkdir /etc/masterha
 6 
 7 [root@zlm2 09:48:35 ~]
 8 #cp /vagrant/masterha/* /etc/masterha/
 9 
10 [root@zlm2 09:50:02 ~]
11 #cd /etc/masterha/
12 
13 [root@zlm2 09:50:09 /etc/masterha]
14 #ll
15 total 36
16 -rwxr-xr-x 1 root root   614 Aug  2 09:50 app1.conf
17 -rwxr-xr-x 1 root root    55 Aug  2 09:50 drop_vip.sh
18 -rwxr-xr-x 1 root root    55 Aug  2 09:50 init_vip.sh
19 -rwxr-xr-x 1 root root   384 Aug  2 09:50 masterha_default.conf
20 -rwxr-xr-x 1 root root  4438 Aug  2 09:50 master_ip_failover
21 -rwxr-xr-x 1 root root 10526 Aug  2 09:50 master_ip_online_change
22 
23 [root@zlm2 09:51:46 /etc/masterha]
24 #cat masterha_default.conf 
25 [server default]
26 #log_level=debug
27 user=zlm
28 password=zlmzlm
29 
30 ssh_user=root
31 ssh_port=3306
32 
33 repl_user=repl
34 repl_password=repl4slave
35 
36 ping_interval=1
37 #shutdown_script=""
38 
39 master_ip_failover_script= /etc/masterha/master_ip_failover
40 master_ip_online_change_script= /etc/masterha/master_ip_online_change
41 
42 [root@zlm2 09:53:56 /etc/masterha]
43 #cat app1.conf 
44 [server default]
45 
46 manager_workdir = /var/log/masterha/app1
47 manager_log = /var/log/masterha/app1/app1.log
48 remote_workdir = /var/log/masterha/app1
49 
50 [server1]
51 hostname=192.168.1.101
52 master_binlog_dir = /data/mysql/mysql3306/logs
53 candidate_master = 1
54 check_repl_delay = 0
55 
56 [server2]
57 hostname=192.168.1.102
58 master_binlog_dir=/data/mysql/mysql3306/logs
59 candidate_master=1
60 check_repl_delay=0
61 
62 [root@zlm2 09:56:20 /etc/masterha]
63 #cat init_vip.sh 
64 vip="192.168.1.200/24"
65 /sbin/ip addr add $vip dev enp0s8
66 
67 [root@zlm2 09:56:23 /etc/masterha]
68 #cat drop_vip.sh 
69 vip="192.168.1.200/24"
70 /sbin/ip addr del $vip dev enp0s8
71 
72 [root@zlm2 09:57:27 /etc/masterha]
73 #ssh zlm3
74 Last login: Thu Aug  2 09:40:20 2018 from 192.168.1.1
75 Welcome to your Vagrant-built virtual machine.
76 
77 [root@zlm3 09:58:04 ~]
78 #mkdir -p /var/log/masterha/app1
79 
80 [root@zlm3 09:58:16 ~]
81 #mkdir /etc/masterha
82 
83 [root@zlm3 09:58:30 ~]
84 #scp zlm2:/etc/masterha/* /etc/masterha
85 app1.conf                                                                                                          100%  498     0.5KB/s   00:00    
86 drop_vip.sh                                                                                                        100%   57     0.1KB/s   00:00    
87 init_vip.sh                                                                                                        100%   57     0.1KB/s   00:00    
88 masterha_default.conf                                                                                              100%  387     0.4KB/s   00:00    
89 master_ip_failover                                                                                                 100% 4438     4.3KB/s   00:00    
90 master_ip_online_change                                                                                            100%   10KB  10.3KB/s   00:00

 

Xvfb script

Check the masterha status on both nodes..

#!/bin/bash

 1 [root@zlm2 10:00:26 /etc/masterha]
 2 #masterha_
 3 masterha_check_repl       masterha_check_status     masterha_manager          masterha_master_switch    masterha_stop
 4 masterha_check_ssh        masterha_conf_host        masterha_master_monitor   masterha_secondary_check
 5 
 6 [root@zlm2 10:00:26 /etc/masterha]
 7 #masterha_check_status --conf=./app1.conf
 8 app1 is stopped(2:NOT_RUNNING).
 9 
10 [root@zlm2 10:01:45 /etc/masterha]
11 #masterha_check_ssh --conf=./app1.conf
12 Thu Aug  2 10:02:05 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
13 Thu Aug  2 10:02:05 2018 - [info] Reading application default configuration from ./app1.conf..
14 Thu Aug  2 10:02:05 2018 - [info] Reading server configuration from ./app1.conf..
15 Thu Aug  2 10:02:05 2018 - [info] Starting SSH connection tests..
16 Thu Aug  2 10:02:06 2018 - [debug] 
17 Thu Aug  2 10:02:05 2018 - [debug]  Connecting via SSH from root@192.168.1.101(192.168.1.101:22) to root@192.168.1.102(192.168.1.102:22)..
18 Warning: Permanently added '192.168.1.101' (ECDSA) to the list of known hosts.
19 Thu Aug  2 10:02:06 2018 - [debug]   ok.
20 Thu Aug  2 10:02:06 2018 - [debug] 
21 Thu Aug  2 10:02:06 2018 - [debug]  Connecting via SSH from root@192.168.1.102(192.168.1.102:22) to root@192.168.1.101(192.168.1.101:22)..
22 Thu Aug  2 10:02:06 2018 - [debug]   ok.
23 Thu Aug  2 10:02:06 2018 - [info] All SSH connection tests passed successfully.
24 
25 [root@zlm2 10:02:06 /etc/masterha]
26 #masterha_check_repl --conf=./app1.conf
27 Thu Aug  2 10:02:15 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
28 Thu Aug  2 10:02:15 2018 - [info] Reading application default configuration from ./app1.conf..
29 Thu Aug  2 10:02:15 2018 - [info] Reading server configuration from ./app1.conf..
30 Thu Aug  2 10:02:15 2018 - [info] MHA::MasterMonitor version 0.56.
31 Thu Aug  2 10:02:15 2018 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln301] Got MySQL error when connecting 192.168.1.101(192.168.1.101:3306) :1045:Access denied for user 'root'@'zlm2' (using password: NO), but this is not a MySQL crash. Check MySQL server settings.
32  at /usr/share/perl5/vendor_perl/MHA/ServerManager.pm line 297.
33 Thu Aug  2 10:02:16 2018 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln301] Got MySQL error when connecting 192.168.1.102(192.168.1.102:3306) :1045:Access denied for user 'root'@'zlm2' (using password: NO), but this is not a MySQL crash. Check MySQL server settings.
34  at /usr/share/perl5/vendor_perl/MHA/ServerManager.pm line 297.
35 Thu Aug  2 10:02:16 2018 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln309] Got fatal error, stopping operations
36 Thu Aug  2 10:02:16 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm line 326.
37 Thu Aug  2 10:02:16 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
38 Thu Aug  2 10:02:16 2018 - [info] Got exit code 1 (Not master dead).
39 
40 MySQL Replication Health is NOT OK!
41 
42 [root@zlm2 10:57:47 /etc/masterha]
43 #masterha_check_repl --conf=./app1.conf --global_conf=./masterha_default.conf //The "--global_conf" option is indispensable.
44 Thu Aug  2 10:57:58 2018 - [info] Reading default configuration from /etc/masterha/masterha_default.conf..
45 Thu Aug  2 10:57:58 2018 - [info] Reading application default configuration from ./app1.conf..
46 Thu Aug  2 10:57:58 2018 - [info] Reading server configuration from ./app1.conf..
47 Thu Aug  2 10:57:58 2018 - [info] MHA::MasterMonitor version 0.56.
48 Thu Aug  2 10:57:59 2018 - [info] GTID failover mode = 1
49 Thu Aug  2 10:57:59 2018 - [info] Dead Servers:
50 Thu Aug  2 10:57:59 2018 - [info] Alive Servers:
51 Thu Aug  2 10:57:59 2018 - [info]   192.168.1.101(192.168.1.101:3306)
52 Thu Aug  2 10:57:59 2018 - [info]   192.168.1.102(192.168.1.102:3306)
53 Thu Aug  2 10:57:59 2018 - [info] Alive Slaves:
54 Thu Aug  2 10:57:59 2018 - [info]   192.168.1.102(192.168.1.102:3306)  Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
55 Thu Aug  2 10:57:59 2018 - [info]     GTID ON
56 Thu Aug  2 10:57:59 2018 - [info]     Replicating from 192.168.1.101(192.168.1.101:3306)
57 Thu Aug  2 10:57:59 2018 - [info]     Primary candidate for the new Master (candidate_master is set)
58 Thu Aug  2 10:57:59 2018 - [info] Current Alive Master: 192.168.1.101(192.168.1.101:3306)
59 Thu Aug  2 10:57:59 2018 - [info] Checking slave configurations..
60 Thu Aug  2 10:57:59 2018 - [info]  read_only=1 is not set on slave 192.168.1.102(192.168.1.102:3306).
61 Thu Aug  2 10:57:59 2018 - [info] Checking replication filtering settings..
62 Thu Aug  2 10:57:59 2018 - [info]  binlog_do_db= , binlog_ignore_db= 
63 Thu Aug  2 10:57:59 2018 - [info]  Replication filtering check ok.
64 Thu Aug  2 10:57:59 2018 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking.
65 Thu Aug  2 10:57:59 2018 - [info] Checking SSH publickey authentication settings on the current master..
66 ssh_exchange_identification: Connection closed by remote host
67 Thu Aug  2 10:57:59 2018 - [warning] HealthCheck: SSH to 192.168.1.101 is NOT reachable.
68 Thu Aug  2 10:57:59 2018 - [info] 
69 192.168.1.101(192.168.1.101:3306) (current master)
70  +--192.168.1.102(192.168.1.102:3306)
71 
72 Thu Aug  2 10:57:59 2018 - [info] Checking replication health on 192.168.1.102..
73 Thu Aug  2 10:57:59 2018 - [info]  ok.
74 Thu Aug  2 10:57:59 2018 - [info] Checking master_ip_failover_script status:
75 Thu Aug  2 10:57:59 2018 - [info]   /etc/masterha/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.1.101 --orig_master_ip=192.168.1.101 --orig_master_port=3306  --orig_master_ssh_port=3306
76 Thu Aug  2 10:57:59 2018 - [info]  OK.
77 Thu Aug  2 10:57:59 2018 - [warning] shutdown_script is not defined.
78 Thu Aug  2 10:57:59 2018 - [info] Got exit code 0 (Not master dead).
79 
80 MySQL Replication Health is OK.
81 
82 //Do these above checking operations on zlm3,too.

#

 

# /etc/rc.d/init.d/Xvfbd

Start MasterHA-manager and check the status.

#

 1 [root@zlm2 11:13:24 /etc/masterha]
 2 #masterha_manager --conf=./app1.conf --global_conf=./masterha_default.conf &
 3 [1] 5091
 4 
 5 [root@zlm2 11:13:55 /etc/masterha]
 6 #Thu Aug  2 11:13:56 2018 - [info] Reading default configuration from ./masterha_default.conf..
 7 Thu Aug  2 11:13:56 2018 - [info] Reading application default configuration from ./app1.conf..
 8 Thu Aug  2 11:13:56 2018 - [info] Reading server configuration from ./app1.conf..
 9 ssh_exchange_identification: Connection closed by remote host
10 ^C
11 
12 [root@zlm2 11:14:09 /etc/masterha]
13 #masterha_check_status --conf=./app1.conf
14 app1 (pid:5091) is running(0:PING_OK), master:192.168.1.101
15 
16 [root@zlm2 10:57:15 /etc/masterha]
17 #cd /var/log/masterha/app1
18 
19 [root@zlm2 11:16:17 /var/log/masterha/app1]
20 #ls -l
21 total 8
22 -rw-r--r-- 1 root root 3821 Aug  2 11:13 app1.log
23 -rw-r--r-- 1 root root   35 Aug  2 11:16 app1.master_status.health
24 
25 [root@zlm2 11:16:19 /var/log/masterha/app1]
26 #tail app1.log 
27  +--192.168.1.102(192.168.1.102:3306)
28 
29 Thu Aug  2 11:13:57 2018 - [info] Checking master_ip_failover_script status:
30 Thu Aug  2 11:13:57 2018 - [info]   /etc/masterha/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.1.101 --orig_master_ip=192.168.1.101 --orig_master_port=3306  --orig_master_ssh_port=3306
31 Thu Aug  2 11:13:57 2018 - [info]  OK.
32 Thu Aug  2 11:13:57 2018 - [warning] shutdown_script is not defined.
33 Thu Aug  2 11:13:57 2018 - [info] Set master ping interval 1 seconds.
34 Thu Aug  2 11:13:57 2018 - [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
35 Thu Aug  2 11:13:57 2018 - [info] Starting ping health check on 192.168.1.101(192.168.1.101:3306)..
36 Thu Aug  2 11:13:57 2018 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond..
37 
38 [root@zlm2 11:16:35 /var/log/masterha/app1]
39 #tail app1.master_status.health 
40 5091    0:PING_OK    master:192.168.1.101

# chkconfig: 345 95 28

 

# description: Starts/Stops X Virtual Framebuffer server

# processname: Xvfb

#

. /etc/init.d/functions

[ "${NETWORKING}" = "no" ] && exit 0

PROG="Xvfb"

PROG_OPTIONS=":7 -ac -screen 0 1024x768x24 +extension RANDR"

PROG_OUTPUT="/tmp/Xvfb.out"

case "$1" in

start)

echo -n "Starting : X Virtual Frame Buffer "

$PROG $PROG_OPTIONS>>$PROG_OUTPUT 2>&1 &

disown -ar

/bin/usleep 500000

status Xvfb & >/dev/null && echo_success || echo_failure

RETVAL=$?

if [ $RETVAL -eq 0 ]; then

/bin/touch /var/lock/subsys/Xvfb

/sbin/pidof -o%PPID -x Xvfb > /var/run/Xvfb.pid

fi

echo

;;

stop)

echo -n "Shutting down : X Virtual Frame Buffer"

killproc $PROG

RETVAL=$?

[ $RETVAL -eq 0 ] && /bin/rm -f /var/lock/subsys/Xvfb /var/run/Xvfb.pid

echo

;;

restart|reload)

$0 stop

$0 start

RETVAL=$?

;;

status)

status Xvfb

RETVAL=$?

;;

*)

echo $"Usage: $0 (start|stop|restart|reload|status)"

exit 1

esac

exit $RETVAL

本文由9159.com发布于www.9159.com,转载请注明出处:找到相应版本的安装包下载

关键词:

上一篇:没有了
下一篇:没有了