In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Environment description
Hostname role IP address zabbix.contoso.comzabbix server192.168.49.129zabbix-db.contoso.commysql server192.168.49.133
I. Environmental preparation
Take one of them as an example, both stations need to complete the following preparatory work:
# close iptables [root@zabbix ~] # iptables-L-nChain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination # disable selinux [root @ zabbix ~] # getenforceDisabled# add time synchronization timing task [root@zabbix ~] # Crontab-l0 * / usr/sbin/ntpdate 210.72.145.44 64.147.116.229 time.nist.gov# modify hostname [root@zabbix ~] # hostnamezabbix.contoso.com# install the necessary dependency package yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb krb5-devel libidn libidn-devel openssl openssl-devel
II. Compile and install zabbix
The following is done on zabbix server (zabbix.contoso.com):
Mkdir-p / opt/toolscd / opt/tools/wget http://prdownloads.sourceforge.net/zabbix/zabbix-2.4.8.tar.gz?downloadtar-zxf zabbix-2.4.8.tar.gz cd zabbix-2.4.8./configure-prefix=/usr/local/zabbix-- enable-server-- enable-agent-- with-net-snmp-- with-mysql-- with-libcurl
If the following error occurs in the compilation:
1) configure: error: MySQL library not found
Solution: yum install mysql-devel-y
2) configure: error: Invalid Net-SNMP directory-unable to find net-snmp-config
Solution: yum install net-snmp-devel-y
In addition, a successful compilation is marked by the following words at the end:
* * Now run 'make install' * Thank you for using Zabbix! *
Finally, use make install for installation:
Make & & make install
Third, install the MySQL database
The following is done on MySQL server (zabbix-db.contoso.com):
1. Install MySQL 5.6.16
Yum-y install make gcc-c++ cmake bison-devel ncurses-develmkdir-p / opt/toolscd / opt/tools/wget wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gztar-zxf mysql-5.6.16.tar.gz cd mysql-5.6.16cmake\ >-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ >-DMYSQL_DATADIR=/usr/local/mysql/data\ >-DSYSCONFDIR=/etc\ >-DWITH_MYISAM _ STORAGE_ENGINE=1\ >-DWITH_INNOBASE_STORAGE_ENGINE=1\ >-DWITH_MEMORY_STORAGE_ENGINE=1\ >-DWITH_READLINE=1\ >-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock\ >-DMYSQL_TCP_PORT=3306\ >-DENABLED_LOCAL_INFILE=1\ >-DWITH_PARTITION_STORAGE_ENGINE=1\ >-DEXTRA_CHARSETS=all\ >-DDEFAULT_CHARSET=utf8\ >-DDEFAULT_COLLATION=utf8_general_cimake & & make install
2. Initialize the MySQL database
# create a user and authorize groupadd mysqluseradd-g mysql mysqlchown-R mysql:mysql / usr/local/mysql# to run the initialization script for initialization [root@zabbix-db mysql-5.6.16] # / usr/local/mysql/scripts/mysql_install_db-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data-- user=mysql# database configuration and startup script modification [root@zabbix-db mysql-5.6.16] ] # mv / etc/my.cnf / etc/my.cnf.bak # if you don't rename / etc/my.cnf Later, there will be an error when starting the compilation and installation of MySQL [root@zabbix-db mysql-5.6.16] # cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld [root@zabbix-db mysql-5.6.16] # chmod + x / etc/init.d/mysqld
3. Start the MySQL service
[root@zabbix-db mysql-5.6.16] # / etc/init.d/mysqld startStarting MySQL.... SUCCESS! [root@zabbix-db mysql-5.6.16] # ps-ef | grep mysqlroot 16925 10 05:24 pts/0 00:00:00 / bin/sh / usr/local/mysql/bin/mysqld_safe-- datadir=/usr/local/mysql/data-- pid-file=/usr/local/mysql/data/zabbix-db.contoso.com.pidmysql 17033 16925 4 05:24 pts/0 00:00:01 / usr/local/mysql/bin/mysqld-- basedir=/usr / local/mysql-- datadir=/usr/local/mysql/data-- plugin-dir=/usr/local/mysql/lib/plugin-- user=mysql-- log-error=/usr/local/mysql/data/zabbix-db.contoso.com.err-pid-file=/usr/local/mysql/data/zabbix-db.contoso.com.pidroot 17064 1050 0 05:25 pts/0 00:00:00 grep mysql [root@zabbix-db mysql-5.6.16] # netstat-lnt | grep 3306tcp 00:: 3306:: * LISTEN [root@zabbix-db mysql-5.6.16] # lsof-I: 3306COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEmysqld 17033 mysql 10u IPv6 60027 0t0 TCP *: mysql (LISTEN)
4. Add the MySQL path to the environment variable
Echo 'export PATH=/usr/local/mysql/bin:$PATH' > > / etc/profilesource / etc/profile
5. Import zabbix data into MySQL database
1) set the root user password in MySQL
Mysqladmin-u root password "123456" # set a password for root users in mysql
2) copy the mysql data from the zabbix installation file to MySQL server (zabbix-db.contoso.com)
Note: this step needs to be completed on zabbix.contoso.com.
[root@zabbix zabbix-2.4.8] # cd / opt/tools/zabbix-2.4.8/database/mysql/ [root@zabbix mysql] # lltotal 2988 schema.sql-1 1000 1000 972946 Apr 20 05:57 data.sql-rw-r--r-- 1 1000 1000 1978341 Apr 20 05:51 schema.sql [root@zabbix mysql] # scp data.sql p _ 20 W_picpaths.sql schema.sql root@192.168.49.133:/tmp/The authenticity of host '192.168.49.133 (192.168.49.133)' can't be established.RSA key fingerprint is f9:ce:14:5d:cd:bb:3c:b4:0d:0b:fc:21:3a:92:43:6b.Are you sure you want to continue connecting (yes/no)? YesWarning: Permanently added '192.168.49.133' (RSA) to the list of known hosts.root@192.168.49.133's password: data.sql 100% 950KB 950.1KB/s 00:00 p_w_picpaths.sql 100% 1932KB 1.9MB/s 00:00 schema.sql 100% 102KB 102.4KB/s 00:00
3) Import zabbix-related data into MySQL database
[root@zabbix-db mysql-5.6.16] # mysql- uroot-p123456Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 2Server version: 5.6.16 Source distributionCopyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.mysql > show databases;+-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | test | +-+ 4 rows in set (0.04 sec) mysql > create database zabbix Query OK, 1 row affected (0.03 sec) mysql > use zabbix;Database changedmysql > source / tmp/schema.sql;Query OK, 0 rows affected (0.48 sec) .MySQL > source / tmp/p_w_picpaths.sql;Query OK, 1 row affected (0.03 sec) .MySQL > source / tmp/data.sql;Query OK, 0 rows affected (0.00 sec).. MySQL > show tables +-- + | Tables_in_zabbix | +-- + | acknowledges | | actions | | alerts | | application_template | | applications | | auditlog | | auditlog_details | | autoreg_host | | conditions | Config | | dbversion | | dchecks | | dhosts | | drules | | dservices | | escalations | | events | | expressions | | functions | | globalmacro | | globalvars | | graph_discovery | | graph_theme | | graphs | | graphs_items | | group_discovery | | group_prototype | | groups | | history | | history_log | | history_str | | history_text | | history_uint | host_discovery | | host_inventory | | hostmacro | | hosts | | hosts_groups | | hosts_templates | | | housekeeper | | httpstep | | httpstepitem | | httptest | | httptestitem | | icon_map | | icon_mapping | | ids | | p_w_picpaths | interface | | interface_discovery | | item_condition | | item_discovery | | items | | items_applications | | | maintenances | | maintenances_groups | | maintenances_hosts | | maintenances_windows | | mappings | | media | | media_type | | opcommand | | opcommand_grp | | opcommand_hst | | opconditions | operations | | opgroup | | opmessage | | opmessage_grp | | opmessage_usr | | optemplate | | | profiles | | proxy_autoreg_host | | proxy_dhistory | | proxy_history | | regexps | | rights | | screens | | screens_items | | scripts | service_alarms | | services | | services_links | | services_times | | sessions | | slides | | | slideshows | | sysmap_element_url | | sysmap_url | | sysmaps | | sysmaps_elements | | sysmaps_link_triggers | | sysmaps_links | | timeperiods | | trends | trends_uint | | trigger_depends | | trigger_discovery | | triggers | | user_history | | users | | | users_groups | | usrgrp | | valuemaps | +-+ 104 rows in set (0.08 sec) mysql > GRANT ALL ON zabbix.* TO 'zbxuser'@'192.168.49.%' IDENTIFIED BY' zbx@123456' | Query OK, 0 rows affected (0.09 sec) mysql > FLUSH PRIVILEGES;Query OK, 0 rows affected (0.02 sec) mysql > quitBye
Fourth, install php and apache
[root@zabbix mysql] # yum-y install php php-devel curl curl-devel net-snmp net-snmp-devel perl-DBI php-mysql php-mbstring php-gd php-xml php-bcmath httpd
5. Configure zabbix server
1. Create a zabbix user
[root@zabbix mysql] # useradd zabbix [root@zabbix mysql] # id zabbixuid=500 (zabbix) gid=500 (zabbix) groups=500 (zabbix)
2. Edit the zabbix server configuration file
[root@zabbix mysql] # cp / usr/local/zabbix/etc/zabbix_server.conf / usr/local/zabbix/etc/zabbix_ server.conf.bak [root @ zabbix mysql] # vi / usr/local/zabbix/etc/zabbix_ server.confession [root @ zabbix mysql] # diff / usr/local/zabbix/etc/zabbix_server.conf.bak / usr/local/zabbix/etc/zabbix_server.conf68c68
< # DBHost=localhost--->DBHost=192.168.49.133 # modifies the database host (either IP or hostname), provided that the database and zabbix are not 92c92 on the same server
< # DBUser=--->DBUser=zbxuser # modify the default database authorized user 94c94
< DBUser=root---># DBUser=root102c102
< # DBPassword=--->DBPassword=zbx@123456 # fill in the database user's password 109a110 > DBSocket=/var/lib/mysql/mysql.sock # specify the socket file location 117c118 of mysql
< # DBPort=3306--->Open the browser, type http://zabbix_server_ip/zabbix, if the above steps are correct, the above screen will appear.
Here is the necessary installation condition check, there are some php parameters are incorrect by default, need to be adjusted, as for the adjusted values are displayed. The method of modification is as follows:
[root@zabbix mysql] # cp / etc/php.ini / etc/php.ini.bak$ (date +% F) [root@zabbix mysql] # vi / etc/php.ini [root@zabbix mysql] # diff / etc/php.ini.bak2016-10-06 / etc/php.ini440c440
< max_execution_time = 30 --->Max_execution_time = 300 449c449
< max_input_time = 60--->Max_input_time = 300729c729
< post_max_size = 8M--->Post_max_size = 16M946a947 > date.timezone = Asia/Shanghai
Note that after the php.ini modification is completed, the above error still exists after the refresh, and the httpd and zabbix server services need to be restarted.
[root@zabbix-db mysql-5.6.16] # / etc/init.d/mysqld restartShutting down MySQL.... SUCCESS! Starting MySQL. SUCCESS! [root@zabbix-db mysql-5.6.16] # [root@zabbix mysql] # / etc/init.d/httpd restartStopping httpd: [OK] Starting httpd: httpd: apr_sockaddr_info_get () failed for zabbix.contoso.comhttpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0. For ServerName [OK]
Check the necessary conditions again, you can see that all the conditions have been met, all OK can proceed to the next step.
Configure the database connection, enter the relevant information about the database as needed, and then click the button below to test the connection. If the test passes, proceed to the next step.
This step is the details of the zabbix server, which can be modified according to the actual situation, but make sure that the port is correct.
At the end of the configuration, give a summary of the configuration before installation, confirm and start the installation.
The installation process will be faster, this is the picture of the installation completed.
OK, the login screen appears successfully. The default login account is admin and the password is zabbix.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.