GrayLog5.2版本单节点一键部署脚本
GrayLog5.2版本单节点一键部署脚本
最新的Graylog5.2版本上周已经发布,具体变化如下
https://go2docs.graylog.org/5-2/changelogs/changelog.html
https://packages.graylog2.org/el/stable/5.2/x86_64
发现存在graylog-datanode-5.2.0-7.x86_64.rpm和graylog-server-5.2.0-7.x86_64.rpm两个安装包
经过安装尝试发现graylog-datanode目前已经内置opensearch,可以作为graylog-server的数据节点
在多次尝试过后,现做了GrayLog5.2版本单节点一键部署安装脚本
具体安装与初始化Graylog5.2单节点的过程如下
GrayLog5.2.0_install.sh
#!/bin/bash
#关闭SELINUX
sed -i 's/enforcing/disabled/g' /etc/selinux/config
setenforce 0
#解压安装包
mkdir -p /opt/GrayLog_install
tar -zxvf ./GrayLog5.2.0_MongoDB6.0_opensearch2.8_RPM.tar.gz -C /opt/GrayLog_install
cat > /etc/yum.repos.d/mongodb-org.repo << \EOF
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=0
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
EOF
cd /opt/GrayLog_install
#安装mongodb-server服务
rpm -Uvh cyrus-sasl*.rpm
rpm -Uvh mongodb*.rpm
#启动mongodb-server服务
systemctl daemon-reload
systemctl enable mongod.service
systemctl start mongod.service
systemctl --type=service --state=active | grep mongod
firewall-cmd --add-port=27017/tcp --permanent --zone=public
firewall-cmd --reload
sysctl -w vm.max_map_count=262144
echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
rpm -ivh /opt/GrayLog_install/graylog-datanode-5.2.0-7.x86_64.rpm
mkdir -p /data/graylog-datanode/opensearch/config
mkdir -p /data/graylog-datanode/opensearch/data
mkdir -p /data/graylog-datanode/opensearch/logs
chown -R graylog-datanode:graylog-datanode /data/graylog-datanode/opensearch/*
sed -i "s/root_password_sha2 =/root_password_sha2 = 429d280c5ddad83d94770b077b22124231efc727d504b107883297304b3e2939/g" /etc/graylog/datanode/datanode.conf
sed -i "s/password_secret =/password_secret = 0pAHJtPdZZUb5yHAvFbBezbWAlQwh9CbRX1rshJEVxM0kV7t0SpIgY5q9tLpVEwWLElhG3EtbvQ03mTm9i0HuvWKwlWgWiIJ/g" /etc/graylog/datanode/datanode.conf
sed -i "s#opensearch_config_location = /var/lib/graylog-datanode/opensearch/config#opensearch_config_location = /data/graylog-datanode/opensearch/config#g" /etc/graylog/datanode/datanode.conf
sed -i "s#opensearch_data_location = /var/lib/graylog-datanode/opensearch/data#opensearch_data_location = /data/graylog-datanode/opensearch/data#g" /etc/graylog/datanode/datanode.conf
sed -i "s#opensearch_logs_location = /var/log/graylog-datanode/opensearch#opensearch_logs_location = /data/graylog-datanode/opensearch/logs#g" /etc/graylog/datanode/datanode.conf
sed -i 's/bufferSize="500"/bufferSizeBytes="50MB"/g' /etc/graylog/datanode/log4j2.xml
#修改graylog-datanode启动时JVM内存大小
sed -i "s/-Xms1g/-Xms2g/g" /etc/graylog/datanode/jvm.options
sed -i "s/-Xmx1g/-Xmx2g/g" /etc/graylog/datanode/jvm.options
systemctl enable graylog-datanode.service
systemctl restart graylog-datanode.service
rpm -ivh /opt/GrayLog_install/graylog-server-5.2.0-7.x86_64.rpm
cp /etc/graylog/server/server.conf /etc/graylog/server/server.conf_default
#修改graylog-server相关配置文件
sed -i "s/password_secret =/password_secret = 0pAHJtPdZZUb5yHAvFbBezbWAlQwh9CbRX1rshJEVxM0kV7t0SpIgY5q9tLpVEwWLElhG3EtbvQ03mTm9i0HuvWKwlWgWiIJ/g" /etc/graylog/server/server.conf
sed -i "s/root_password_sha2 =/root_password_sha2 = 429d280c5ddad83d94770b077b22124231efc727d504b107883297304b3e2939/g" /etc/graylog/server/server.conf
sed -i "s@#root_timezone = UTC@root_timezone = Asia/Shanghai@g" /etc/graylog/server/server.conf
sed -i "s@#http_bind_address = 127.0.0.1:9000@http_bind_address = 0.0.0.0:9000@g" /etc/graylog/server/server.conf
sed -i "s/allow_highlighting = false/allow_highlighting = true/g" /etc/graylog/server/server.conf
#修改graylog-server启动时JVM内存大小
sed -i "s/-Xms1g -Xmx1g/-Xms2g -Xmx2g/g" /etc/sysconfig/graylog-server
firewall-cmd --add-port=9000/tcp --permanent --zone=public
firewall-cmd --reload
#启动graylog-server服务
systemctl daemon-reload
systemctl restart graylog-server
systemctl enable graylog-server
sleep 10
cat /var/log/graylog-server/server.log | grep username | grep password
(图片点击放大查看)
获取本文一键安装脚本与相关安装包
要查看更多文章内容,请您先登录/注册