Switching zabbix database

Data Export (backup)

mysqldump -h127.0.0.1 -uzabbix -pzabbix zabbix > zabbix.sql

Data Import (Recovery)

mysql -h127.0.0.1 -uzabbix -pzabbix zabbix < zabbix.sql

Modify the configuration zabbix

Find zabbix.conf.php file, the default is as follows:

<?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'localhost';
$DB['PORT']     = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'zabbix';

// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

Here we need to modify the configuration information for the new database address and port and the username library name


Create a new user in zebbix can generate test data in a new database that migration was successful, but soon visit zabbix page will appear Zabbix server is not running (the front display Zabbix server to stop working problem)

Well, I can only zabbix stop service, use the command

service zabbix-server stop

About zabbix-server stuck there are several problems, but in the online search is not my problem no way I can only kill the main process look okay Main PID:. 24677 (zabbix_server),

kill -9 24677

Then perform zabbix service stops, the card refuses to move without too much direct zabbix process approach may also have depend on each other. Finally, no way to batch kill

ps -ef | grep zabbix-server | grep -v 'grep' | awk '{print $2}' |xargs kill -9  

 

ps -ef: Print out the running processes information

grep hello: Finding information through the pipeline process with a progress zabbix-server keywords

grep -v 'grep': grep own process of removing the information

awk '{print $ 2}': number obtaining process

xargs kill -9: kill the process

Open another window to view the log.

tail -999f /var/log/zabbix/zabbix_server.log

How to view the log direction did not connect to the database 

Think of it were only changed zabbix.conf.php this file, the file has not changed /etc/zabbix/zabbix_server.conf

You should fill in data address switch


This should be no problem to perform:
 

service zabbix-server start

See the following states: 

service zabbix-server status

 

Access zabbix page correctly

发布了131 篇原创文章 · 获赞 7 · 访问量 3万+

Guess you like

Origin blog.csdn.net/weixin_43064185/article/details/103618413
Recommended