Monthly filing: June 2017

Permission denied cannot be started after Zabbix Agent configuration is completed

The newly installed Zabbix Agent on the node machine cannot be started today.

1. Check the Zabbix Agent log file to find out the reason.

 # cat /var/log/zabbix/zabbix_agentd.log 63133:20170601:092700.920 ************************** 63133:20170601:092700.920 using configuration file: /etc/zabbix/zabbix_agentd.conf 63133:20170601:092700.920 cannot set resource limit: [13] Permission denied 63133:20170601:092700.920 cannot disable core dump, exiting... 63137:20170601:092711.171 Starting Zabbix Agent [cong171163].  Zabbix 3.2.6 (revision 67849). 63137:20170601:092711.171 **** Enabled features **** 63137:20170601:092711.171 IPv6 support: YES 63137:20170601:092711.171 TLS support: YES 63137:20170601:092711.171 ************************** ......

2. At this time, you only need to turn off Selinux. There are two schemes;

2.1. Temporary closing

 # setenforce 0

2.2. Permanent shutdown (reboot host)

 # vim /etc/selinux/config SELINUX=enforcing

change

 SELINUX=disabled

3. After the operation is completed, start the zabbix agent service again

# systemctl start zabbix-agent.service

4. View ports

 # ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port  LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:*  LISTEN 0 128 *:10050 *:* LISTEN 0 80 :::3306 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 128 :::10050 :::*

Zabbix agent starts successfully, and port 10050 is running.

Zabbix Chinese monitoring server graph chart shows garbled code

Zabbix's support for Chinese is not very good, but sometimes we still choose Chinese for management. In the web interface monitored by Zabbix, the Chinese under the graphical icon will display small blocks, which is incorrect and requires downloading fonts. For example, "Microsoft Yahei"

"Microsoft Yahei. ttf" is named "msyh. ttf"

Upload the downloaded font to/zabbix/fonts/font

Modify two places in the/zabbix/include/defines.inc.php file

 define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); define('ZBX_FONT_NAME', 'DejaVuSans');

change

 define('ZBX_GRAPH_FONT_NAME', 'msyh'); define('ZBX_FONT_NAME', 'msyh');

Finally, restart the web server.

MariaDB MaxScale 2.1.3 Read write separation installation configuration of middleware database

Operating system: CentOS Linux release 7.3.1611 (Core)
Database: MariaDB-10.2.6-linux-glibc_214-x86_64
MaxScale server: 10.200.10.55
Master server: 172.16.8.56
Slave server: 172.16.8.57
Slave server: 172.16.8.58

1. There are many installation methods of maxscale, such as source code installation, rpm, binary build, etc. I choose binary to install.

Download the corresponding version and download address according to the scenario needs// mariadb.com/downloads/maxscale

 [ root@localhost  ~]# groupadd maxscale [ root@localhost  ~]# useradd -g maxscale maxscale [ root@localhost  ~]# cd /usr/local [ root@localhost  local]# wget //downloads.mariadb.com/MaxScale/2.1.3/centos/7server/x86_64/maxscale-2.1.3.centos.7.tar.gz [ root@localhost  local]# tar zxvf maxscale-2.1.3.centos.7.tar.gz [ root@localhost  local]# ln -s maxscale-2.1.3.centos.7 maxscale [ root@localhost  local]# cd maxscale [ root@zhu56  maxscale]# chown -R maxscale var

It is recommended to create a soft connection, which is helpful for future version upgrading and later maintenance.

2. To install maxscale for the first time, you need to create a log related directory

 [ root@localhost  ~]# mkdir /var/log/maxscale [ root@localhost  ~]# mkdir /var/lib/maxscale [ root@localhost  ~]# mkdir /var/run/maxscale [ root@localhost  ~]# mkdir /var/cache/maxscale

3. The following directories must have maxscala user permissions

 [ root@localhost  ~]# chown maxscale /var/log/maxscale [ root@localhost  ~]# chown maxscale /var/lib/maxscale [ root@localhost  ~]# chown maxscale /var/run/maxscale [ root@localhost  ~]# chown maxscale /var/cache/maxscale

4. In order to enable Maxscale to start successfully, it is also necessary to create a configuration file. Copy the configuration file template in the Maxscale directory to ETC.

 [ root@localhost  ~]# cp /usr/local/maxscale/etc/maxscale.cnf.template /etc/maxscale.cnf

5. Before modifying the configuration file, a user needs to be created and authorized on the main server, and this user is used for MySQL monitoring and routing functions

 MariaDB [(none)]> create user 'jiankongdb'@'%' identified by 'jiankong123'; MariaDB [(none)]> grant SELECT on mysql.user to 'jiankongdb'@'%'; MariaDB [(none)]> GRANT SELECT ON mysql.db TO 'jiankongdb'@'%'; MariaDB [(none)]> GRANT SELECT ON mysql.tables_priv TO 'jiankongdb'@'%'; MariaDB [(none)]> GRANT SHOW DATABASES ON *.* TO 'jiankongdb'@'%'; MariaDB [(none)]> grant REPLICATION CLIENT on *.* to 'jiankongdb'@'%'; MariaDB [(none)]> GRANT replication slave, replication client,SELECT ON *.* TO jiankongdb@'%';

6. View authorization

 MariaDB [(none)]> SHOW GRANTS FOR'jiankong'@'%';

7. Next, start to modify the maxscale.cnf configuration file, otherwise it will fail to start.

 [ root@localhost  ~]# vim /etc/maxscale.cnf # MaxScale documentation on GitHub: # //github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Documentation-Contents.md # Global parameters # # Complete list of configuration options: # //github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Getting-Started/Configuration-Guide.md #Global configuration [maxscale] threads=1 # Server definitions # # Set the address of the server to the network # address of a MySQL server. # [server1] type=server address=172.16.8.56 port=3306 protocol=MySQLBackend serv_weight=1 [server2] type=server address=172.16.8.57 port=3306 protocol=MySQLBackend serv_weight=3 [server3] type=server address=172.16.8.58 port=3306 protocol=MySQLBackend serv_weight=3 # Monitor for the servers # # This will keep MaxScale aware of the state of the servers. # MySQL Monitor documentation: # //github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Monitors/MySQL-Monitor.md #MariaDB status monitoring [MySQL Monitor] type=monitor module=mysqlmon servers=server1,server2,server3 user=jiankong passwd=jiankong123 monitor_interval=10000 Detect_stale_master=true # Even if the slave fails, ensure that the master is responsible for reading and writing # Service definitions # # Service Definition for a read-only service and # a read/write splitting service. # # ReadConnRoute documentation: # //github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Routers/ReadConnRoute.md #Read [Read-Only Service] type=service router=readconnroute servers=server1,server2,server3 user=jiankong passwd=jiankong123 router_options=slave Enable_root_user=1 # Allow root user to log in and execute Weightby=serv_weight # Master slave weight # ReadWriteSplit documentation: # //github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Routers/ReadWriteSplit.md #Write [Read-Write Service] type=service router=readwritesplit servers=server1,server2,server3 user=jiankong passwd=jiankong123 max_slave_connections=100% Use_sql_variables_in=master # Ensure session consistency Enable_root_user=1 # Allow root login Max_slave_replication_lag=3600 # Allow slave synchronization time to exceed the master synchronization time, and do not route if it exceeds the master synchronization time # This service enables the use of the MaxAdmin interface # MaxScale administration guide: # //github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Reference/MaxAdmin.md [MaxAdmin Service] type=service router=cli # Listener definitions for the services # # These listeners represent the ports the # services will listen on. # [Read-Only Listener] type=listener service=Read-Only Service protocol=MySQLClient port=4008 [Read-Write Listener] type=listener service=Read-Write Service protocol=MySQLClient port=4006 [MaxAdmin Listener] type=listener service=MaxAdmin Service protocol=maxscaled socket=default

Save and exit.
8. Create a startup script below

 [ root@localhost  ~]# cp /usr/local/maxscale-2.1.3.centos.7/share/maxscale.service /usr/lib/systemd/system/ [ root@localhost  ~]# vim /usr/lib/systemd/system/maxscale.service

9. Modify ExecStart=///bin/maxscale in maxscale.service to ExecStart=/usr/local/maxscale/bin/maxscale

 [ root@localhost  ~]# chmod 755 /usr/lib/systemd/system/maxscale.service [ root@localhost  ~]# systemctl enable maxscale [ root@localhost  ~]# systemctl daemon-reload [ root@localhost  ~]# systemctl start maxscale

10. Add variable value

 [ root@localhost ~]#Vi/etc/profile//Add the following content to the last line and exit! PATH=$PATH:/usr/local/maxscale/bin export PATH [ root@localhost ~]#Source/etc/profile//Make its variables take effect immediately

11. Next, you can use MaxAdmin for management. MaxAdmin is a simple client management interface, which can be used to interact with the MariaDB MaxScale server. It can display the internal statistics status of the MariaDB MaxScale and control the operations of the MariaDB MaxScale. Details:
//mariadb.com/kb/en/mariadb-enterprise/maxadmin-admin-interface/

 [ root@localhost ~]#Maxadmin//Enter MaxScale> list servers Servers. ---------------+--------------+-------+-------------+----------------- Server | Address | Port | Connections | Status  ---------------+--------------+-------+-------------+----------------- server1 | 172.16.8.56 | 3306 | 0 | Master, Running server2 | 172.16.8.57 | 3306 | 0 | Slave, Running server2 | 172.16.8.58 | 3306 | 0 | Slave, Running ---------------+--------------+-------+-------------+-----------------

12. MaxScale has been configured. Now you can use the client to connect to the Maxscale server port 4006.

DirectAdmin Solution for Changing ID and IP Address

I

Log in to the DirectAdmin server

 # cd /usr/local/directadmin/scripts # ./ getLicense.sh 7353 12345 # service directadmin restart

Where 7353 is the customer ID and 12345 is the authorization ID

If your server has multiple different IPs, you can forcibly specify an IP authorization, such as 10.200.200.26

 # cd /usr/local/directadmin/scripts # ./ getLicense.sh 7353 12345 127.0.0.1 # service directadmin restart

II

If the IP needs to be replaced after updating the authorization, follow the steps below

 # cd /usr/local/directadmin/scripts # ./ ipswap.sh 10.200.10.26 10.200.200.26

10.200.10.26 is the original IP and 10.200.200.26 is the new IP. Then press the following command to restart all services (or restart the server and omit the following operations)

 # /etc/init.d/httpd restart # /etc/init.d/proftpd restart # /etc/init.d/exim restart # /etc/init.d/dovecot restart

III

DirectAdmin failed to start. Check whether port 2222 is running;

 # netstat -antp

If port 2222 is not running, DirectAdmin is not started. Restart again;

 # service directadmin restart Stopping DirectAdmin: [FAILED] Starting DirectAdmin: [ OK ] # service directadmin restart Stopping DirectAdmin: [FAILED] Starting DirectAdmin: [ OK ] # service directadmin restart Stopping DirectAdmin: [FAILED]

Each time you start the system, you will be prompted OK, and will be prompted FAILED. The directadmin control panel cannot be opened. Enter the directadmin installation directory:

 # whereis directadmin # cd /usr/local/directadmin # ./ directadmin The ip of this machine (10.200.10.26) does not match the ip in the license file Check the value of your ethernet_dev=venet0:1 setting in your /usr/local/directadmin/conf/directadmin.conf file and the output of /sbin/ifconfig

According to the prompt of DA authorization failure or IP assignment error, it is found that the authorized IP address specified by the customer is in venet0:0, while that specified in the configuration file of directadmin is venet0:1

 # ifconfig -a # vi conf/directadmin.conf
 ethernet_dev=venet0:1 change ethernet_dev=venet0:0

Execute again;

 # ./ directadmin [ root@hip  directadmin]# ./ directadmin Bind Error: Make sure there aren't any copies running in the background Address already in use

Open//ip: 2222. The login window is displayed successfully

IV

In the process of using DA, you will encounter the situation that the dataskq process occupies up to 100% of the CPU, which causes the website to open very slowly. The process of dataskq is an action response process. It is executed every minute in the/etc/cron.d/directadmin_cron task
/According to the var/log/directadmin/errortaskq.log log feedback, dataskq always checks that named is not started, which leads to repeated restarts. Therefore, it may be that named in the machine is uninstalled during the upgrade. The repair method is as follows:

 # yum install bind dbus dbus-libs -y # mv /etc/init.d/named /etc/init.d/named.bak # wget //www.directadmin.com/named # chmod 755 /etc/init.d/named # /sbin/chkconfig named reset # /etc/init.d/named restart

If the above solution does not solve this problem, just kill the dataskq process.
More help// help.directadmin.com/