MHA+非root用户SSH等效性配置
环境:CentOS5.8 MySQL5.5.17 实验:搭建MHA高可用架构(非root用户SSH等效性配置)SSH等效性用户配置的是:concert 端口:1314 MHA配置文件 [concert@mhamanager mha]$ more /etc/masterha_default.cnf [server default] user = root password = mysql_admi
环境:CentOS5.8
MySQL5.5.17
实验:搭建MHA高可用架构(非root用户SSH等效性配置)SSH等效性用户配置的是:concert 端口:1314
MHA配置文件
[concert@mhamanager mha]$ more /etc/masterha_default.cnf
[server default]
user = root
password = mysql_admin
ssh_user = concert
ssh_port = 1314
repl_user = repl
repl_password = repl_pwd
ping_interval = 3
ping_type = select
[concert@mhamanager mha]$ more /etc/appl.cnf
[server default]
manager_workdir = /mha/appl
manager_log = /mha/appl/manager.log
remote_workdir = /mha/appl
[server1]
hostname = 192.168.66.88
master_binlog_dir = /data/lib/mysql
candidate_master = 1
[server2]
hostname = 192.168.66.89
master_binlog_dir = /data/lib/mysql
candidate_master = 1
[server3]
hostname = 192.168.66.120
no_master = 1
port = 3307
问题:配置好非root用户SSH等效性后,通过masterha_check_ssh检查没有问题
[concert@mhamanager ~]$ /usr/bin/masterha_check_ssh --conf=/etc/appl.cnf
Tue Sep 2 15:06:01 2014 - [info] Reading default configuratoins from /etc/masterha_default.cnf..
Tue Sep 2 15:06:01 2014 - [info] Reading application default configurations from /etc/appl.cnf..
Tue Sep 2 15:06:01 2014 - [info] Reading server configurations from /etc/appl.cnf..
Tue Sep 2 15:06:01 2014 - [info] Starting SSH connection tests..
Tue Sep 2 15:06:01 2014 - [debug]
Tue Sep 2 15:06:01 2014 - [debug] Connecting via SSH from concert@192.168.66.88(192.168.66.88:1314) to concert@192.168.66.89(192.168.66.89:1314)..
Tue Sep 2 15:06:01 2014 - [debug] ok.
Tue Sep 2 15:06:01 2014 - [debug] Connecting via SSH from concert@192.168.66.88(192.168.66.88:1314) to concert@192.168.66.120(192.168.66.120:1314)..
Tue Sep 2 15:06:01 2014 - [debug] ok.
Tue Sep 2 15:06:02 2014 - [debug]
Tue Sep 2 15:06:01 2014 - [debug] Connecting via SSH from concert@192.168.66.89(192.168.66.89:1314) to concert@192.168.66.88(192.168.66.88:1314)..
Tue Sep 2 15:06:01 2014 - [debug] ok.
Tue Sep 2 15:06:01 2014 - [debug] Connecting via SSH from concert@192.168.66.89(192.168.66.89:1314) to concert@192.168.66.120(192.168.66.120:1314)..
Tue Sep 2 15:06:02 2014 - [debug] ok.
Tue Sep 2 15:06:02 2014 - [debug]
Tue Sep 2 15:06:02 2014 - [debug] Connecting via SSH from concert@192.168.66.120(192.168.66.120:1314) to concert@192.168.66.88(192.168.66.88:1314)..
Tue Sep 2 15:06:02 2014 - [debug] ok.
Tue Sep 2 15:06:02 2014 - [debug] Connecting via SSH from concert@192.168.66.120(192.168.66.120:1314) to concert@192.168.66.89(192.168.66.89:1314)..
Tue Sep 2 15:06:02 2014 - [debug] ok.
Tue Sep 2 15:06:02 2014 - [info] All SSH connection tests passed successfully.
但通过masterha_check_repl检查则不通过
[concert@mhamanager ~]$ /usr/bin/masterha_check_repl --conf=/etc/appl.cnf
Tue Sep 2 17:10:08 2014 - [info] Reading default configuratoins from /etc/masterha_default.cnf..
Tue Sep 2 17:10:08 2014 - [info] Reading application default configurations from /etc/appl.cnf..
Tue Sep 2 17:10:08 2014 - [info] Reading server configurations from /etc/appl.cnf..
Tue Sep 2 17:10:08 2014 - [info] MHA::MasterMonitor version 0.55.
Tue Sep 2 17:10:08 2014 - [info] Dead Servers:
Tue Sep 2 17:10:08 2014 - [info] Alive Servers:
Tue Sep 2 17:10:08 2014 - [info] 192.168.66.88(192.168.66.88:3306)
Tue Sep 2 17:10:08 2014 - [info] 192.168.66.89(192.168.66.89:3306)
Tue Sep 2 17:10:08 2014 - [info] 192.168.66.120(192.168.66.120:3307)
Tue Sep 2 17:10:08 2014 - [info] Alive Slaves:
Tue Sep 2 17:10:08 2014 - [info] 192.168.66.89(192.168.66.89:3306) Version=5.5.17-log (oldest major version between slaves) log-bin:enabled
Tue Sep 2 17:10:08 2014 - [info] Replicating from 192.168.66.88(192.168.66.88:3306)
Tue Sep 2 17:10:08 2014 - [info] Primary candidate for the new Master (candidate_master is set)
Tue Sep 2 17:10:08 2014 - [info] 192.168.66.120(192.168.66.120:3307) Version=5.5.17-log (oldest major version between slaves) log-bin:enabled
Tue Sep 2 17:10:08 2014 - [info] Replicating from 192.168.66.88(192.168.66.88:3306)
Tue Sep 2 17:10:08 2014 - [info] Not candidate for the new Master (no_master is set)
Tue Sep 2 17:10:08 2014 - [info] Current Alive Master: 192.168.66.88(192.168.66.88:3306)
Tue Sep 2 17:10:08 2014 - [info] Checking slave configurations..
Tue Sep 2 17:10:08 2014 - [info] Checking replication filtering settings..
Tue Sep 2 17:10:08 2014 - [info] binlog_do_db= , binlog_ignore_db=
Tue Sep 2 17:10:08 2014 - [info] Replication filtering check ok.
Tue Sep 2 17:10:08 2014 - [info] Starting SSH connection tests..
Tue Sep 2 17:10:10 2014 - [error][/usr/lib/perl5/vendor_perl/MHA/MasterMonitor.pm, ln386] Error happend on checking configurations. SSH Configuration Check Failed!
at /usr/lib/perl5/vendor_perl/MHA/MasterMonitor.pm line 341
Tue Sep 2 17:10:10 2014 - [error][/usr/lib/perl5/vendor_perl/MHA/MasterMonitor.pm, ln482] Error happened on monitoring servers.
Tue Sep 2 17:10:10 2014 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
解决方案:
1、增加remote_workdir(运行MySQL实例的服务器)的工作目录权限,其中会生成日志文件,将该目录拥有者设为concert
[root@master88 ~]# chown -R concert:concert /mha/
2、添加concert为MySQL同组用户,使其有读取MySQL binary/relay log文件和relay_log.info文件的权限,以及日志目录的写权限
[root@bakmaster ~]# usermod -g mysql concert
再次检查
[concert@mhamanager mha]$ /usr/bin/masterha_check_repl --conf=/etc/appl.cnf
Wed Sep 3 22:27:41 2014 - [info] Reading default configuratoins from /etc/masterha_default.cnf..
Wed Sep 3 22:27:41 2014 - [info] Reading application default configurations from /etc/appl.cnf..
Wed Sep 3 22:27:41 2014 - [info] Reading server configurations from /etc/appl.cnf..
Wed Sep 3 22:27:41 2014 - [info] MHA::MasterMonitor version 0.55.
Wed Sep 3 22:27:41 2014 - [info] Dead Servers:
Wed Sep 3 22:27:41 2014 - [info] Alive Servers:
Wed Sep 3 22:27:41 2014 - [info] 192.168.66.88(192.168.66.88:3306)
Wed Sep 3 22:27:41 2014 - [info] 192.168.66.89(192.168.66.89:3306)
Wed Sep 3 22:27:41 2014 - [info] 192.168.66.120(192.168.66.120:3307)
Wed Sep 3 22:27:41 2014 - [info] Alive Slaves:
Wed Sep 3 22:27:41 2014 - [info] 192.168.66.89(192.168.66.89:3306) Version=5.5.17-log (oldest major version between slaves) log-bin:enabled
Wed Sep 3 22:27:41 2014 - [info] Replicating from 192.168.66.88(192.168.66.88:3306)
Wed Sep 3 22:27:41 2014 - [info] Primary candidate for the new Master (candidate_master is set)
Wed Sep 3 22:27:41 2014 - [info] 192.168.66.120(192.168.66.120:3307) Version=5.5.17-log (oldest major version between slaves) log-bin:enabled
Wed Sep 3 22:27:41 2014 - [info] Replicating from 192.168.66.88(192.168.66.88:3306)
Wed Sep 3 22:27:41 2014 - [info] Not candidate for the new Master (no_master is set)
Wed Sep 3 22:27:41 2014 - [info] Current Alive Master: 192.168.66.88(192.168.66.88:3306)
Wed Sep 3 22:27:41 2014 - [info] Checking slave configurations..
Wed Sep 3 22:27:41 2014 - [info] Checking replication filtering settings..
Wed Sep 3 22:27:41 2014 - [info] binlog_do_db= , binlog_ignore_db=
Wed Sep 3 22:27:41 2014 - [info] Replication filtering check ok.
Wed Sep 3 22:27:41 2014 - [info] Starting SSH connection tests..
Wed Sep 3 22:27:42 2014 - [info] All SSH connection tests passed successfully.
Wed Sep 3 22:27:42 2014 - [info] Checking MHA Node version..
Wed Sep 3 22:27:43 2014 - [info] Version check ok.
Wed Sep 3 22:27:43 2014 - [info] Checking SSH publickey authentication settings on the current master..
Wed Sep 3 22:27:43 2014 - [info] HealthCheck: SSH to 192.168.66.88 is reachable.
Wed Sep 3 22:27:43 2014 - [info] Master MHA Node version is 0.54.
Wed Sep 3 22:27:43 2014 - [info] Checking recovery script configurations on the current master..
Wed Sep 3 22:27:43 2014 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data/lib/mysql --output_file=/mha/appl/save_binary_logs_test --manager_version=0.55 --start_file=mysql-bin.000004
Wed Sep 3 22:27:43 2014 - [info] Connecting to concert@192.168.66.88(192.168.66.88)..
Creating /mha/appl if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /data/lib/mysql, up to mysql-bin.000004
Wed Sep 3 22:27:43 2014 - [info] Master setting check done.
Wed Sep 3 22:27:43 2014 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Wed Sep 3 22:27:43 2014 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=192.168.66.89 --slave_ip=192.168.66.89 --slave_port=3306 --workdir=/mha/appl --target_version=5.5.17-log --manager_version=0.55 --relay_log_info=/data/lib/mysql/relay-log.info --relay_dir=/data/lib/mysql/ --slave_pass=xxx
Wed Sep 3 22:27:43 2014 - [info] Connecting to concert@192.168.66.89(192.168.66.89:1314)..
Checking slave recovery environment settings..
Opening /data/lib/mysql/relay-log.info ... ok.
Relay log found at /data/lib/mysql, up to mysql-relay-bin.000006
Temporary relay log file is /data/lib/mysql/mysql-relay-bin.000006
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Sep 3 22:27:43 2014 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=192.168.66.120 --slave_ip=192.168.66.120 --slave_port=3307 --workdir=/mha/appl --target_version=5.5.17-log --manager_version=0.55 --relay_log_info=/data/lib/mysqlb/relay-log.info --relay_dir=/data/lib/mysqlb/ --slave_pass=xxx
Wed Sep 3 22:27:43 2014 - [info] Connecting to concert@192.168.66.120(192.168.66.120:1314)..
Checking slave recovery environment settings..
Opening /data/lib/mysqlb/relay-log.info ... ok.
Relay log found at /data/lib/mysqlb, up to mysql-relay-bin.000005
Temporary relay log file is /data/lib/mysqlb/mysql-relay-bin.000005
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Sep 3 22:27:44 2014 - [info] Slaves settings check done.
Wed Sep 3 22:27:44 2014 - [info]
192.168.66.88 (current master)
+--192.168.66.89
+--192.168.66.120
Wed Sep 3 22:27:44 2014 - [info] Checking replication health on 192.168.66.89..
Wed Sep 3 22:27:44 2014 - [info] ok.
Wed Sep 3 22:27:44 2014 - [info] Checking replication health on 192.168.66.120..
Wed Sep 3 22:27:44 2014 - [info] ok.
Wed Sep 3 22:27:44 2014 - [warning] master_ip_failover_script is not defined.
Wed Sep 3 22:27:44 2014 - [warning] shutdown_script is not defined.
Wed Sep 3 22:27:44 2014 - [info] Got exit code 0 (Not master dead).
MySQL Replication Health is OK.
OK!问题解决。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the "Discover" button in the lower right corner, and then select the "Notes" option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the "Follow" button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select "Personal Information"

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

For most Windows users, Remote Desktop Protocol (RDP) has always been the first choice for remote management because it provides a friendly graphical interface. However, for system administrators who require more granular control, SSH may better suit their needs. Through SSH, administrators can interact with remote devices through the command line, which can make management work more efficient. The advantage of SSH is its security and flexibility, making it easier for administrators to perform remote management and maintenance work, especially when dealing with a large number of devices or performing automated tasks. So while RDP excels in terms of user-friendliness, for system administrators, SSH is superior in terms of power and control. Previously, Windows users needed to borrow

Analysis of user password storage mechanism in Linux system In Linux system, the storage of user password is one of the very important security mechanisms. This article will analyze the storage mechanism of user passwords in Linux systems, including the encrypted storage of passwords, the password verification process, and how to securely manage user passwords. At the same time, specific code examples will be used to demonstrate the actual operation process of password storage. 1. Encrypted storage of passwords In Linux systems, user passwords are not stored in the system in plain text, but are encrypted and stored. L

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

The steps to install SSH on your Debian11 server and create a new user to allow SSH remote login are as follows: Step 1: Install SSH In order to install the SSH server, you need to log in to your Debian11 server as the root user or a user with sudo privileges. Execute the following command in the terminal to install the SSH server: sudoaptupdatesudoaptinstallopenssh-server Step 2: Create a new user To create a new user, you can use the adduser command. Replace the following command with your desired username: sudoaddusernew_username You will be prompted to set the new user's password and other
