Ошибка zabbix-server-mysql после установки
10
Посты
2
Пользователи
1
Likes
9,368
Просмотры
(@provodnick)
Active Member
Присоединился: 2 года назад
Сообщения: 6
Topic starter
12.08.2020 17:23
Добрый день.
Поднял Proxmox на который в свою очередь устанавливаю виртуалку Zabbix поверх Debian 10.
Делаю всё по инструкции, но не поднимается mysql.
# wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
# dpkg -i zabbix-release_5.0-1+buster_all.deb
# apt update
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent
если ставить базу не с репозитория zabbix :
#apt install mariadb-server
#mysql_secure_installation
то все работает.
вот какие ошибки даёт
root@zabbix:~# mysql_secure_installation
-bash: mysql_secure_installation: command not found
root@zabbix:~# mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run /mysqld/mysqld.sock’ (2)
root@zabbix:~#
помогите разобраться, спасибо
(@zerox)
Prominent Member Admin
Присоединился: 9 лет назад
Сообщения: 806
12.08.2020 19:45
Так все правильно. Вы ставите базу именно командой:
apt install mariadb-server
Без нее базы не будет, поэтому и ошибка
-bash: mysql_secure_installation: command not found
Mariadb просто не установлена.
(@zerox)
Prominent Member Admin
Присоединился: 9 лет назад
Сообщения: 806
(@provodnick)
Active Member
Присоединился: 2 года назад
Сообщения: 6
Topic starter
13.08.2020 06:23
да помогло apt install mariadb-server, но,
разве apt install zabbix-server-mysql не должен поставить базу?
root@zabbix:~# apt install zabbix-server-mysql
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
fping libaio1 libconfig-inifiles-perl libcurl4 libdbd-mysql-perl libdbi-perl
libevent-2.1-6 libltdl7 libmariadb3 libodbc1 libopenipmi0 libreadline5
libsensors-config libsensors5 libsnappy1v5 libsnmp-base libsnmp30
libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3
mariadb-common mysql-common snmpd
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
libmyodbc odbc-postgresql tdsodbc unixodbc-bin lm-sensors
snmp-mibs-downloader snmptrapd zabbix-frontend-php virtual-mysql-server
The following NEW packages will be installed:
fping libaio1 libconfig-inifiles-perl libcurl4 libdbd-mysql-perl libdbi-perl
libevent-2.1-6 libltdl7 libmariadb3 libodbc1 libopenipmi0 libreadline5
libsensors-config libsensors5 libsnappy1v5 libsnmp-base libsnmp30
libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3
mariadb-common mysql-common snmpd zabbix-server-mysql
0 upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.7 MB of archives.
After this operation, 72.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
после установки:
root@zabbix:~# mariadb -V
mariadb Ver 15.1 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
root@zabbix:~# mysql -V
mysql Ver 15.1 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
root@zabbix:~# mysql_secure_installation
-bash: mysql_secure_installation: command not found
root@zabbix:~# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
root@zabbix:~#
по моему он ставит клиента если я не ошибаюсь
Это сообщение было изменено 2 года назад от provodnick
(@provodnick)
Active Member
Присоединился: 2 года назад
Сообщения: 6
Topic starter
13.08.2020 06:44
разница между двумя командами при установке на чистую систему
apt install mariadb-server
The following additional packages will be installed:
galera-3 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
libmariadb3 libmpfr6 libreadline5 libsigsegv2 libsnappy1v5 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.3
mariadb-client-core-10.3 mariadb-common mariadb-server-10.3 mariadb-server-core-10.3 mysql-common psmisc rsync socat
Suggested packages:
gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx
mariadb-test netcat-openbsd tinyca
The following NEW packages will be installed:
galera-3 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
libmariadb3 libmpfr6 libreadline5 libsigsegv2 libsnappy1v5 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.3
mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 mysql-common psmisc rsync socat
apt install zabbix-server-mysql
The following additional packages will be installed:
fping libaio1 libconfig-inifiles-perl libcurl4 libdbd-mysql-perl libdbi-perl libevent-2.1-6 libltdl7 libmariadb3 libodbc1 libopenipmi0
libreadline5 libsensors-config libsensors5 libsnappy1v5 libsnmp-base libsnmp30 libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3
mariadb-common mysql-common snmpd
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libmyodbc odbc-postgresql tdsodbc unixodbc-bin lm-sensors
snmp-mibs-downloader snmptrapd zabbix-frontend-php virtual-mysql-server
The following NEW packages will be installed:
fping libaio1 libconfig-inifiles-perl libcurl4 libdbd-mysql-perl libdbi-perl libevent-2.1-6 libltdl7 libmariadb3 libodbc1 libopenipmi0
libreadline5 libsensors-config libsensors5 libsnappy1v5 libsnmp-base libsnmp30 libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3
mariadb-common mysql-common snmpd zabbix-server-mysql
(@provodnick)
Active Member
Присоединился: 2 года назад
Сообщения: 6
Topic starter
13.08.2020 09:39
ради интереса попробовал 4 версию zabbix-а
root@zabbix:~# apt install zabbix-server-mysql
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
fping galera-3 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libcurl4 libdbd-mysql-perl libdbi-perl libencode-locale-perl libevent-2.1-6 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libltdl7
liblwp-mediatypes-perl libmariadb3 libmpfr6 libodbc1 libopenipmi0 libreadline5 libsensors-config libsensors5 libsigsegv2 libsnappy1v5 libsnmp-base libsnmp30 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3 mariadb-server-core-10.3
mysql-common psmisc rsync snmpd socat
Suggested packages:
gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libmyodbc odbc-postgresql tdsodbc unixodbc-bin lm-sensors snmp-mibs-downloader libwww-perl mailx mariadb-test netcat-openbsd tinyca snmptrapd zabbix-frontend-php
The following NEW packages will be installed:
fping galera-3 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libcurl4 libdbd-mysql-perl libdbi-perl libencode-locale-perl libevent-2.1-6 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libltdl7
liblwp-mediatypes-perl libmariadb3 libmpfr6 libodbc1 libopenipmi0 libreadline5 libsensors-config libsensors5 libsigsegv2 libsnappy1v5 libsnmp-base libsnmp30 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3 mariadb-server-core-10.3
mysql-common psmisc rsync snmpd socat zabbix-server-mysql
0 upgraded, 46 newly installed, 0 to remove and 0 not upgraded.
Need to get 30.3 MB of archives.
After this operation, 187 MB of additional disk space will be used.
Do you want to continue? [Y/n]
тут видно что mariadb-server ставит
Простите если что не так, я ещё не профи, возможно ошибаюсь, просто пытаюсь разобраться
Это сообщение было изменено 2 года назад от provodnick
(@zerox)
Prominent Member Admin
Присоединился: 9 лет назад
Сообщения: 806
13.08.2020 10:49
разве apt install zabbix-server-mysql не должен поставить базу?
Это зависит от того, какие зависимости установлены в пакете. Если в зависимостях не стоит mysql сервер, ставиться не будет. Похоже разработчики в 5-й версии убрали эту зависимость и теперь базу надо ставить отдельно вручную.
Это сообщение было изменено 2 года назад от Zerox
(@provodnick)
Active Member
Присоединился: 2 года назад
Сообщения: 6
Topic starter
13.08.2020 14:16
если я не ошибаюсь пропустили create user zabbix@localhost identified by ‘password’; в вашей инструкции
(@provodnick)
Active Member
Присоединился: 2 года назад
Сообщения: 6
Topic starter
13.08.2020 15:24
с вашего позволения чуть поправил
# wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
# dpkg -i zabbix-release_5.0-1+buster_all.deb
# apt update
# apt install mariadb-server
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent mariadb-server
# mysql_secure_installation
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by ‘zabbix’;
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> flush privileges;
mysql> quit;
nano /etc/zabbix/zabbix_server.conf
DBHost=localhost (уже прописано)
DBName=zabbix (уже прописано)
DBUser=zabbix (уже прописано)
DBPassword=zabbix
Timeout=20 (править с 4 на 20 по вашей рекомендации)
дальше по вашей инструкции, + можно и ссылочку на тайм зоны добавить для удобства Https://www.php.net/manual/ru/timezones.php
(@zerox)
Prominent Member Admin
Присоединился: 9 лет назад
Сообщения: 806
13.08.2020 16:24
Спасибо. Надо будет обновить инструкцию на днях.
Hello IT fellas, When I came to the office today, I saw a warning on our monitoring system that said database error, connection refused. You can see the mentioned picture below.
Then I checked out the logs of the Zabbix which is given error below.
[[email protected] ~]# tail -f /var/log/zabbix/zabbix_server.log
1144:20210531:082544.703 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
1144:20210531:082544.703 database is down: reconnecting in 10 seconds
I’ve seen the same problem in the past and didn’t check the DB username and password whether it works. Let’s check the partition which is running on our MySQL. As you see in the picture below the file system /var/lib/mysql which is linked to /dev/sda5 is full. Seems this partition needs to be extended, I also have to check the housekeeper out not to get a similar problem in the future after solving this problem.
I prefer to extend the partition using the GParted Live CD. I shut down the server and started it with GParted. In this case, I will just extend the current disk size, and will not interested in the housekeeper issue. I won’t write anything and give any information from now on, you will just see how to extend your Linux partition with GParted.
Extending disk size of the linux partition is done. Let’s reject the GParted Live Cd and start the Zabbix OS.
The problem with the disk filling up has been resolved by extending the disk size. After this post, I will take a look housekeeper issue. Thanks for your time reading my article.
Regards,
Hasan Altin
#mysql #zabbix
Вопрос:
Ошибка Zabbix во время установки на ubuntu 20.4
# mysql -u root -p
Enter password:
b. Установите Zabbix сервер, интерфейс, агент
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
Решение:
В части установки пакеты MySQL-сервера недоступны в документах, чтобы избежать этой ошибки. выполните команду, указанную ниже.
# apt install mysql-server
# systemctl status mysql
# systemctl start mysql
Комментарии:
1. Это нормально — ответить на свой собственный вопрос. Однако, пожалуйста, отредактируйте свой вопрос: Удалите решение из вопроса и добавьте: Когда (…) я получу ошибку
ERROR 2002 ...(2). Как я могу это решить? Вы можете отредактировать заголовок (меньше слов): «Установка Zabbix, подключение к MySQL через сокет».
Ответ №1:
Решение:
В части установки пакеты MySQL-сервера недоступны в документах, чтобы избежать этой ошибки. выполните команду, указанную ниже.
#apt install mysql-server
#systemctl status mysql
#systemctl start mysql
Once in a while MySQL needs restart when a security patch is installed but every time when MySQL is restarted Zabbix server terminates:
16584:20160919:132424.526 [Z3005] query failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) [select escalationid,actionid,triggerid,eventid,r_eventid,nextcheck,esc_step,status,itemid from escalations where itemid is not null order by actionid,triggerid,itemid,escalationid] 16584:20160919:132424.540 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 16584:20160919:132424.572 Cannot connect to the database. Exiting... 16583:20160919:132424.592 [Z3005] query failed: [2006] MySQL server has gone away [insert into history (itemid,clock,ns,value) values (62544,1474255464,578564042,75.676449),(48084,1474255464,580184457,67.923016); ] 16583:20160919:132424.622 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 16583:20160919:132424.641 Cannot connect to the database. Exiting... 16559:20160919:132424.674 [Z3005] query failed: [1053] Server shutdown in progress [select hostid,key_,state,evaltype,formula,error,lifetime from items where itemid=30264] 16559:20160919:132424.712 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 16559:20160919:132424.714 Cannot connect to the database. Exiting... 16582:20160919:132424.802 item "Zabbix server:mysql.status[Bytes_sent]" became not supported: Received value [ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)] is not suitable for value type [Numeric (float)] 16582:20160919:132424.802 [Z3005] query failed: [2006] MySQL server has gone away [update items set state=1,error='Received value [ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)] is not suitable for value type [Numeric (float)]' where itemid=23784; ] 16580:20160919:132424.815 [Z3005] query failed: [2006] MySQL server has gone away [insert into history (itemid,clock,ns,value) values (57444,1474255464,812126377,9.089814); ] 16580:20160919:132424.828 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 16582:20160919:132424.828 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 16580:20160919:132424.828 Cannot connect to the database. Exiting... 16582:20160919:132424.828 Cannot connect to the database. Exiting... 16553:20160919:132424.935 One child process died (PID:16584,exitcode/signal:1). Exiting ... 16553:20160919:132426.974 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 16553:20160919:132426.975 Cannot connect to the database. Exiting...
This problem was introduced with 3.0.x (previously 2.4 could survive restart of MySQL). Clearly Zabbix Server should keep trying to re-establish connection with database for some time, ideally with configurable timeout. At the moment Zabbix server gives up on DB connectivity too fast so any restart of database (even if it takes seconds) reliably knock down Zabbix server.
This issue may be somewhat related to ZBX-10753 (which discusses startup failure) or similar to ZBX-11004…




