莱卡云安装并配置Graylog教程

Graylog是一个基于Elasticsearch、MongoDB和自身服务器组件的日志管理平台,能够集中收集、索引和分析来自各种来源的日志数据。为帮助用户了解如何安装和配置Graylog,本文就以莱卡云为例为大家详细介绍下。

莱卡云官网:点击进入

一、配置莱卡云服务器

1、点击上述链接进入莱卡云官网,注册并登录。

2、点击“产品服务”,可以看到多种产品,如美国CN2云服务器、香港CN2 GIA云服务器、韩国云服务器、新加坡云服务器、中国香港云服务器,用户可以按需选择。

莱卡云服务器

  • 操作系统:推荐使用Ubuntu 20.04 LTS或CentOS 8。
  • 硬件:至少4GB内存、2核CPU和20GB磁盘空间。

3、选择合适的方案,购买即可。

二、安装MongoDB和Elasticsearch

1、在Ubuntu上运行以下命令来来更新包。

sudo apt update && sudo apt upgrade

2、安装MongoDB

导入MongoDB GPG密钥并添加仓库:

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongod

验证安装:运行mongo--version检查版本。

3、安装Elasticsearch

下载并安装Elasticsearch,确保版本兼容:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update
sudo apt install -y elasticsearch
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

编辑配置文件/etc/elasticsearch/elasticsearch.yml,设置cluster.name:graylog,然后重启服务:sudo systemctl restart elasticsearch。

安装完成后,使用curl-X GET"localhost:9200"测试Elasticsearch是否运行正常。如果返回JSON响应,则表示成功。

三、安装和配置Graylog服务器

1、下载并安装Graylog仓库:

wget https://packages.graylog2.org/repo/packages/graylog-4.3-repository_latest.deb
sudo dpkg -i graylog-4.3-repository_latest.deb
sudo apt update
sudo apt install -y graylog-server graylog-enterprise-plugins

2、配置Graylog

编辑配置文件/etc/graylog/server/server.conf,关键设置包括:

  • password_secret:生成一个随机密钥,例如运行pwgen-N 1-s 96命令生成,并添加到配置中。
  • root_password_sha2:使用echo-n"您的密码"|sha256sum生成SHA256哈希,替换默认值。
  • http_bind_address:设置为服务器IP和端口,如0.0.0.0:9000以允许远程访问。
  • elasticsearch_hosts:确保指向Elasticsearch地址,如http://localhost:9200。

3、启动Graylog服务

sudo systemctl daemon-reload
sudo systemctl start graylog-server
sudo systemctl enable graylog-server

检查服务状态:

sudo systemctl status graylog-server

如果一切正常,用户可以通过浏览器访问http://您的服务器IP:9000登录Graylog Web界面。

相关推荐:

Graylog是干嘛的

莱卡云韩国双ISP原生住宅IP VPS速度性能测评

莱卡云日本双ISP原生住宅IP VPS速度性能测评

使用教程

衡天云如何使用宝塔面板搭建环境

2025-12-4 17:33:56

术语库

混合云是什么?混合云的优势有哪些?

2022-7-20 15:07:08

相关推荐