一键安装脚本实现快速部署GrayLog Server 4.2.10单机版
由于局点(分支机构)较多,为了快速部署GrayLog单机版
所以简单整理了一下GrayLog的安装步骤脚本,来实现一键安装GrayLog Server 4.2.10单机版
只需上传GraylogServer4.2.10_install.tar.gz和GrayLogServer_install.sh安装脚本并执行一键安装脚本即可完成GrayLog Server 4.2.10单机版的安装
(图片可点击放大查看)
其中安装包和脚本的下载链接如下
链接:https://share.weiyun.com/MySqbCkG 密码:295bcq
说明:
1、GraylogServer4.2.10_install.tar.gz中为GrayLogServer安装时所需的JDK+pwgen+MongoDB+elasticsearch+graylog-server的RPM包使用createrepo方式打包制作成本地yum源来实现离线yum安装
(图片可点击放大查看)
2、建议的资源配置如下 操作系统:CentOS7.9 CPU 8核 内存建议8GB内存以上 磁盘大小:建议单独一块数据盘,并挂载到/data目录 3、其中ES和MongoDB未做加密认证,因为只监听在本地127.0.0.1不对外暴露,若需要安全加固,请自行配置GrayLogServer_install.sh脚本
脚本内容如下
#!/bin/bash
#关闭SELINUX
sed-i's/enforcing/disabled/g'/etc/selinux/config
setenforce0
#解压安装包
tar-zxvfGraylogServer4.2.10_install.tar.gz-C/opt/
mkdir/opt/yum_repo_backup
mv/etc/yum.repos.d/CentOS*.repo/opt/yum_repo_backup
cp/opt/graylog_local.repo/etc/yum.repos.d/
echo"priority=1">>/etc/yum.repos.d/graylog_local.repo
#安装JDK+pwgen
yuminstall-yjava-1.8.0-openjdk-headless.x86_64
yuminstall-ypwgen
cp/opt/yum_repo_backup/CentOS*.repo/etc/yum.repos.d/
#安装mongodb-server服务
yuminstall-ymongodb-org
#启动mongodb-server服务
systemctldaemon-reload
systemctlenablemongod.service
systemctlstartmongod.service
systemctl--type=service--state=active|grepmongod
firewall-cmd--add-port=27017/tcp--permanent--zone=public
firewall-cmd--reload
#安装elasticsearch
yuminstallelasticsearch-y
#单独创建目录用于存放elasticsearch数据
mkdir-p/data/elasticsearch/data
mkdir-p/data/elasticsearch/logs
chown-Relasticsearch:elasticsearch/data/elasticsearch
cp/etc/elasticsearch/elasticsearch.yml/etc/elasticsearch/elasticsearch.yml_default
#修改elasticsearch相关配置文件
sed-i"s@#cluster.name:my-application@cluster.name:graylog@g"/etc/elasticsearch/elasticsearch.yml
sed-i"s#path.data:/var/lib/elasticsearch#path.data:/data/elasticsearch/data#g"/etc/elasticsearch/elasticsearch.yml
sed-i"s#path.logs:/var/log/elasticsearch#path.logs:/data/elasticsearch/logs#g"/etc/elasticsearch/elasticsearch.yml
#修改JVM内存大小
sed-i"s/-Xms1g/-Xms4g/g"/etc/elasticsearch/jvm.options
sed-i"s/-Xmx1g/-Xmx4g/g"/etc/elasticsearch/jvm.options
#启动elasticsearch服务
systemctldaemon-reload
systemctlenableelasticsearch.service
systemctlrestartelasticsearch.service
firewall-cmd--add-port=9200/tcp--permanent--zone=public
firewall-cmd--reload
curl-s-XGET'http://127.0.0.1:9200/_cluster/health?pretty=true'
curl-s-XGET'http://127.0.0.1:9200/_cat/nodes?v'
#安装graylog-server服务
yuminstallgraylog-server-y
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=79a560ed561e6fc57b3d02a59335b7710fada90625e4c661fbb7b780fb92ceaa/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服务
systemctlrestartgraylog-server
systemctlenablegraylog-server
安装过程截图如下
目前只在CentOS7.9环境下进行部署测试,其他版本未测试
[root@centos~]#ll
total642960
-rw-------.1rootroot1648Jul32021anaconda-ks.cfg
-rw-r--r--.1rootroot658378578Jun1811:56GraylogServer4.2.10_install.tar.gz
-rw-r--r--.1rootroot3065Jun1813:07GrayLogServer_install.sh
[root@centos~]#chmod755GrayLogServer_install.sh
[root@centos~]#./GrayLogServer_install.sh
(图片可点击放大查看)
(图片可点击放大查看)
(图片可点击放大查看)
三、登录GrayLog Web界面
账号密码为
admin/GrayLog@2022
(图片可点击放大查看)
(图片可点击放大查看)
(图片可点击放大查看)
Tips
若需要修改admin登录密码请使用如下命令
echo-n"EnterPassword:"&&head-1'
'|sha256sum|cut-d""-f1
并修改/etc/graylog/server/server.conf中root_password_sha2值
重启Graylog服务生效
审核编辑 :李倩
-
cpu
+关注
关注
68文章
10863浏览量
211738 -
Server
+关注
关注
0文章
90浏览量
24032 -
脚本
+关注
关注
1文章
389浏览量
14864
原文标题:一键安装脚本实现快速部署GrayLog Server 4.2.10单机版
文章出处:【微信号:释然IT杂谈,微信公众号:释然IT杂谈】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
评论