CentOS 安装 配置防火墙
官方下载链接: https://zookeeper.apache.org/doc/r3.5.6/zookeeperStarted.html#sc_Download
官方 release 版本发布页面:
cd /home/yyxz/download
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.6-bin.tar.gz
tar -zxvf apache-zookeeper-3.5.6-bin.tar.gz
mv /home/yyxz/download/apache-zookeeper-3.5.6-bin /usr/local/
cd /usr/local/apache-zookeeper-3.5.6-bin/conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
mkdir /usr/local/apache-zookeeper-3.5.6-bin/data
mkdir /usr/local/apache-zookeeper-3.5.6-bin/logs
# 修改 dataDir=/tmp/zookeeper 部分如下
dataDir=/usr/local/apache-zookeeper-3.5.6-bin/data/
dataLogDir=/usr/local/apache-zookeeper-3.5.6-bin/logs/
# 在 clientPort=2181 下添加如下内容(视实际情况进行添加):
server.1=api2.yyxz.link:2888:3888
server.2=hw.yyxz.link:2888:3888
server.3=localhost:2888:3888
# 从 zookeeper3.5 版本之后,需要自定义端口(默认使用 8080),否则无法启动
admin.serverPort=8090
vim /etc/profile
# 在文件末尾增加两行
export ZOOKEEPER_HOME=/usr/local/apache-zookeeper-3.5.6-bin
export PATH=$PATH:$ZOOKEEPER_HOME/bin
# End vim
source /etc/profile
echo $PATH
echo $ZOOKEEPER_HOME
# 查看 jdk 安装位置
which java
ls -lrt /usr/bin/java
ls -lrt /etc/alternatives/java
/etc/alternatives/java -> /usr/java/jdk1.8.0_202-amd64/jre/bin/java
# vim /etc/profile,配置 JAVA_HOME
export JAVA_HOME=/usr/java/jdk1.8.0_202-amd64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
# 查看启动状态
/usr/local/apache-zookeeper-3.5.6-bin/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.5.6-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: standalone
# 设置开机启动
## vim /etc/rc.d/rc.local,添加到开机启动脚本中
/usr/local/apache-zookeeper-3.5.6-bin/bin/zkServer.sh start
# 拷贝到其他服务器
## 焦晨利阿里云
scp -r /usr/local/apache-zookeeper-3.5.6-bin/ root@api2.yyxz.link:/usr/local/
password:yyxz@20191111
## 华为云
scp -r /usr/local/apache-zookeeper-3.5.6-bin/ root@hw.yyxz.link:/usr/local/
password:Ntrees83
# 这是每台机器的 id
## 焦晨利阿里云
echo 1 > /usr/local/apache-zookeeper-3.5.6-bin/data/myid
## 华为云
echo 2 > /usr/local/apache-zookeeper-3.5.6-bin/data/myid
其他:
查看端口是否开启的命令如下:
firewall-cmd --zone=public --query-port=2181/tcp
如果返回 no,说明端口未放开,执行以下命令即可:
firewall-cmd --zone=public --add-port=2181/tcp --permanent
# permanent 为永久生效,没有此参数重启后失效
安装参考: https://www.zabbix.com/download?zabbix=4.4&os_distribution=centos&os_version=7&db=mysql
中间报错:
2:postfix-2.10.1-7.el7.x86_64 has missing requires of libmysqlclient.so.18
# 解决办法
wget http://www.percona.com/redir/downloads/Percona-XtraDB-Cluster/5.5.37-25.10/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
rpm -ivh Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
创建数据库:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
#Edit file
/etc/zabbix/zabbix_server.conf
设置时区
#Edit file /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
启动(开机自启动)
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd
卸载重装低版本:
[root@localhost ~]# rpm -qa | grep zabbix
zabbix-agent-4.4.1-1.el7.x86_64
zabbix-release-4.4-1.el7.noarch
zabbix-web-4.4.1-1.el7.noarch
zabbix-server-mysql-4.4.1-1.el7.x86_64
zabbix-web-mysql-4.4.1-1.el7.noarch
yum remove zabbix-agent-4.4.1-1.el7.x86_64
yum remove zabbix-release-4.4-1.el7.noarch
yum remove zabbix-web-4.4.1-1.el7.noarch
yum remove zabbix-server-mysql-4.4.1-1.el7.x86_64
yum remove zabbix-web-mysql-4.4.1-1.el7.noarch
# Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
# Install Zabbix server, frontend, agent
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
# Create initial database
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;
建立数据库:
create database zabbix character set utf8 collate utf8_bin;
create user 'zabbix'@'%' identified by 'yyxz@20191113';
# 赋予 zabbix 用户从外部操作 zabbix 数据库权限
grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'yyxz@20191113';
FLUSH PRIVILEGES;
quit;
启动报错:
version libmysqlclient_18 not defined in file libmysqlclient.so.18
# 解决办法,下载一个:
wget -O /usr/lib/libmysqlclient.so.18 http://files.directadmin.com/services/es_7.0_64/libmysqlclient.so.18
chmod a+x /usr/lib/libmysqlclient.so.18
遇到报错,还未解决:
-- Unit zabbix-server.service has begun starting up.
Nov 13 18:43:48 localhost.localdomain zabbix_server[1102]: /usr/sbin/zabbix_server: relocation error: /usr/sbin/zabbix_server: symbol mysql_next_result, version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time refe
Nov 13 18:43:48 localhost.localdomain systemd[1]: zabbix-server.service: control process exited, code=exited status=127
Nov 13 18:43:48 localhost.localdomain systemd[1]: Failed to start Zabbix Server.
-- Subject: Unit zabbix-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit zabbix-server.service has failed.
--
-- The result is failed.
Nov 13 18:43:48 localhost.localdomain systemd[1]: Unit zabbix-server.service entered failed state.
Nov 13 18:43:48 localhost.localdomain systemd[1]: zabbix-server.service failed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
上一篇: centos Ftp 服务搭建
下一篇: 谈谈自己对于 AOP 的了解
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论