In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Environmental preparation:
Operating system: CentOS 7 or above
one。 Install mysql
1. Set up a Mysql account
Groupadd mysql
Useradd-s / sbin/nologin-g mysql-M mysql
two。 Create a mysql software directory and modify permissions
Mkdir-p / usr/local/mysql
Mkdir-p / data/mysql
Mkdir-p / usr/local/mysql/run/
Chown-R root:mysql / usr/local/mysql
Chown-R mysql:mysql / data/mysql
Chmod 775 / usr/local/mysql/run/
3. Install dependency packages
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
4. Download the source package and decompress it
Http://mirrors.sohu.com/mysql/
Cd / usr/local/src
Tar-zxf mysql-5.7.11.tar.gz
Cd mysql-5.7.11
5. Compile
Cmake\
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\
-DMYSQL_DATADIR=/data/mysql\
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DEXTRA_CHARSETS=all\
-DENABLED_LOCAL_INFILE=1\
-DDOWNLOAD_BOOST=1\
-DWITH_BOOST=/usr/local/boost
6. Installation
Make & & make install
7. Initialize MySQL
Cd / usr/local/mysql/bin
/ mysqld-- initialize-- user=mysql-- datadir=/data/mysql-- basedir=/usr/local/mysql-- socket=/var/lib/mysql/mysql.sock-- pid-file=/usr/local/mysql/run/mysqld.pid
8. Add MySQL service and set boot up
Cd / usr/local/mysql/support-files
Cp mysql.server / etc/init.d/mysqld
Cd / etc/init.d/
Chkconfig-add mysqld
Chkconfig-level 2345 mysqld on
9. Edit the my.cnf file
Vi / etc/my.cnf
[mysqld]
Port = 3306
Socket = / var/lib/mysql/mysql.sock
User = mysql
Basedir = / usr/local/mysql
Datadir = / data/mysql
Pid-file=/usr/local/mysql/run/mysqld.pid
Log-error = / var/log/mysql/mysqld.log
Skip-external-locking
Key_buffer_size = 16m
Max_allowed_packet = 1m
Table_open_cache = 64
Sort_buffer_size = 512K
Net_buffer_length = 8K
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8m
Thread_cache_size = 8
Query_cache_size = 8m
Tmp_table_size = 16m
# skip-networking
Max_connections = 500,
Max_connect_errors = 100
Open_files_limit = 65535
Log-bin=mysql-bin
Binlog_format = mixed
Server-id = 1
Expire_logs_days = 10
[mysqldump]
Quick
Max_allowed_packet = 16m
[mysql]
No-auto-rehash
[myisamchk]
Key_buffer_size = 20m
Sort_buffer_size = 20m
Read_buffer = 2m
Write_buffer = 2m
[mysqlhotcopy]
Interactive-timeout
10. Restart MySQL
/ etc/init.d/mysql start
Starting MySQL.. SUCCESS!
11. Log in to MySQL
Cd.. / bin/
. / mysql-uroot-p / / Log in to MySQL for the first time. The password file is in. You can also see the password from the last line of make install. If you do not see it, you can refer to the following steps to change the password.
Enter password:
twelve。 Forgetting the root password can be modified in the following ways
Vi / etc/my.cnf
[mysqld]
Skip-grant-tables
Restart the mysqld service and no longer need a password to log in again
13. Modify root password
Use mysql
Update user set authentication_string=PASSWORD ('zabbix') where User='root'
14. Exit and delete the skip-grant-tables in mysql.cnf and log in again with a new password
15. You need to reset the new password for the first login, otherwise any command will prompt:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Set password for root@localhost = password ('zabbix')
16. Create a zabbix database
Create database zabbix character set utf8 collate utf8_bin
Grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'
two。 Install Zabbix
1. Install the official yum source
Rpm-ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2.yum installs zabbix-server\ zabbix-web\ zabbix-agent
Yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3. Initialize the database
Cd / usr/share/doc/zabbix-server-mysql-3.0.*
Zcat create.sql.gz | mysql-uroot-pzabbix zabbix
4. Edit zabbix server profile
Vi / etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
5. Enable zabbix server and agent services and set boot up
Systemctl start zabbix-server
Systemctl enable zabbix-server
Systemctl start zabbix-agent
Systemctl enable zabbix-agent
6. Ensure that the configuration of php meets the requirements of zabbix (the following configurations are included by default), and change timezone to PRC
Vi / etc/httpd/conf.d/zabbix.conf
Php_value max_execution_time 300
Php_value memory_limit 128M
Php_value post_max_size 16M
Php_value upload_max_filesize 2M
Php_value max_input_time 300
Php_value always_populate_raw_post_data-1
Php_value date.timezone Asia/Shanghai
7. Turn on the Apache service and set boot up
Systemctl start httpd
Systemctl enable httpd
8. Open the zabbix page http://192.168.17.100/zabbix/, which requires initialization for the first time
PHP check passed
Connect to mysql database
Make sure that the mysql.sock protocol file is under / var/lib/mysql/. If not, it can be modified through my.cnf.
Customize the details of zabbix server
Initialization complete
Enter the zabbix interface
9. Modify language
Zabbix 3.0.3 can be changed to simplified Chinese directly on the interface.
III. Agent installation
1.Linux OS rpm package installation
Rpm-ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
Yum install zabbix-agent-y
Sed-I's / ^ server =. * / Server=192.168.17.100/g' / etc/zabbix/zabbix_agentd.conf
Sed-I's / ^ ServerActive =. * / ServerActive=192.168.17.100/g' / etc/zabbix/zabbix_agentd.conf
Sed-I's / ^ Hostname =. * / Hostname=TestHost/g' / etc/zabbix/zabbix_agentd.conf
Service zabbix-agent start
2.Windows OS agent Settin
Http://www.zabbix.com/downloads/3.0.0/zabbix_agents_3.0.0.win.zip
Modify the hostname in zabbix_agent\ conf\ zabbix_agentd.win.conf
Run the following command in the cmd window (64 bit\ 32 bit)
"C:\ Program Files\ zabbix\ bin\ win64\ zabbix_agentd.exe"-c "C:\ Program Files\ zabbix\ conf\ zabbix_agentd.win.conf"-I
"C:\ Program Files\ zabbix\ bin\ win64\ zabbix_agentd.exe"-c "C:\ Program Files\ zabbix\ conf\ zabbix_agentd.win.conf"-s
"C:\ Program Files\ zabbix\ bin\ win32\ zabbix_agentd.exe"-c "C:\ Program Files\ zabbix\ conf\ zabbix_agentd.win.conf"-I
"C:\ Program Files\ zabbix\ bin\ win32\ zabbix_agentd.exe"-c "C:\ Program Files\ zabbix\ conf\ zabbix_agentd.win.conf"-s
3.Linux OS source package installation
Groupadd zabbix
Useradd zabbix-g zabbix-s / sbin/nologin
Cd / usr/local/src/
Wget http://ufpr.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz
Tar-xzvf zabbix-3.0.3.tar.gz
Cd zabbix-3.0.3
. / configure-prefix=/usr/local/zabbix/-enable-agent
Make
Make install
Sed-I's / ^ server =. * / Server=192.168.17.100/g' / usr/local/zabbix/etc/zabbix_agentd.conf
Sed-I's / ^ ServerActive =. * / ServerActive=192.168.17.100/g' / usr/local/zabbix/etc/zabbix_agentd.conf
Sed-I's / ^ Hostname =. * / Hostname=TestHost/g' / usr/local/zabbix/etc/abbix_agentd.conf
Start the agent service
/ usr/local/zabbix/sbin/zabbix_agentd start
Set up boot boot
Vi / etc/rc.d/rc.local
Add the following
/ usr/local/zabbix/sbin/zabbix_agentd start
four。 Additional configuration
1. Open system firewall port
Firewall-cmd-permanent-zone=public-add-rich-rule= "rule family=" ipv4 "source address=" 192.168.17.0 take 24 "port protocol=" tcp "port=" 80 "accept"
Firewall-cmd-permanent-zone=public-add-rich-rule= "rule family=" ipv4 "source address=" 192.168.17.0 take 24 "port protocol=" tcp "port=" 10050 "accept"
Firewall-cmd-permanent-zone=public-add-rich-rule= "rule family=" ipv4 "source address=" 192.168.17.0 take 24 "port protocol=" tcp "port=" 10051 "accept"
Firewall-cmd-reload
two。 Upgrade from an older version of zabbix
@ Old version of zabbix
Disable zabbix-server services to prevent new data from being generated
Service zabbix-server stop
Back up the old version of the database
Mysqldump-uroot-pzabbix zabbix > zabbix.sql
Transfer the backed-up database to the new zabbix platform
@ New version of zabbix
Stop the zabbix-server/agent service
Service zabbix-server stop
Service zabbix-agent stop
Delete the initialized database of zabbix 3.0.3
Drop database zabbix
Import an older version of the database
Mysql-uroot-pzabbix zabbix
< zabbix.sql 查看日志tail -f /var/log/zabbix/zabbix-server.log,数据库会自动升级 8816:20160527:140441.797 completed 0% of database upgrade 8816:20160527:140441.812 completed 1% of database upgrade 8816:20160527:140441.846 completed 2% of database upgrade 8816:20160527:140441.878 completed 3% of database upgrade 8816:20160527:140441.911 completed 4% of database upgrade 8816:20160527:140441.925 completed 5% of database upgrade 8816:20160527:140441.957 completed 6% of database upgrade 8816:20160527:140441.969 completed 7% of database upgrade 8816:20160527:140441.981 completed 8% of database upgrade 8816:20160527:140441.992 completed 9% of database upgrade 8816:20160527:140442.022 completed 10% of database upgrade .... 重新开启服务,一切正常 service zabbix-server start service zabbix-agent start 3.中文乱码问题 cd /usr/share/zabbix/fonts 上传任一中文字体到该目录,并修改php文件 vi /usr/share/zabbix/include/defines.inc.php #('ZBX_GRAPH_FONT_NAME', 'graphfont'); #将graphfont替换为msyh(雅黑字体)文件名即可 #('ZBX_FONT_NAME', 'graphfont'); #将graphfont替换为msyh(雅黑字体)文件名即可 4.设置邮件报警 Zabbix 3.0可以直接在web界面配置邮件报警,不需要脚本的形式 安装Sendmail yum install sendmail -y chkconfig sendmail on service sendmail start 进入管理-报警媒介类型-Email-设置发送邮箱的信息 管理-用户群组,确保用户群组有对监控设备有对应权限 配置-动作,有告警信息时通过Email发送给相关的用户 编辑动作详情 默认接收人: {TRIGGER.STATUS}: {TRIGGER.NAME} 默认信息: 告警主机:{HOST.NAME} 告警IP:{HOST.IP} 告警时间:{EVENT.DATE}-{EVENT.TIME} 告警等级:{TRIGGER.SEVERITY} 告警信息:{TRIGGER.NAME} 问题详情:{ITEM.NAME}:{ITEM.VALUE} 时间ID:{EVENT.ID} 恢复主题: 恢复{TRIGGER.STATUS}, 服务器:{HOSTNAME1}: {TRIGGER.NAME}已恢复! 恢复信息: 告警主机:{HOST.NAME} 告警IP:{HOST.IP} 告警时间:{EVENT.DATE}-{EVENT.TIME} 告警等级:{TRIGGER.SEVERITY} 告警信息:{TRIGGER.NAME} 问题详情:{ITEM.NAME}:{ITEM.VALUE} 时间ID:{EVENT.ID} 注意:使用部分的邮箱无法正常发送邮件,日志报错: 11707:20160527:165712.955 Login denied: Authentication failed: 535 换成其它邮件就好了 管理-用户-报警媒介,设置接收告警的邮箱地址Turn off the monitoring zabbix-agent service and receive the alarm email.
5. Configure the default home page to be zabbix
Vi / etc/httpd/conf.d/httpd.conf
Modify the following:
DocumentRoot "/ usr/share/zabbix"
Just restart the service.
Service httpd restart
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.