知识库

Loading

0 评论 / 0 点赞 / 59 阅读 最后更新: 2022-11-22 作者: 飞致云 总字数: 2000

1. 为什么对接elasticsearch

JumpServer默认把命令存储在数据库的terminal_command表,资产数量多命令记录多的情况下直接查询数据库获取数据会有卡顿现象,同时也不利于归档整理和分类。为了解决该问题JumpServer支持将命令存储记录在Elasticsearch集群,存储在Elasticsearch上的数据也支持按天创建索引方便整理和归档。

2. 对接elasticsearch步骤

2.1 环境说明

用途 IP地址 软件版本
JumpServer 10.1.11.31 7.17.7
Elasticsearch 10.1.11.32 v2.8.1

备注:es测试环境单节点

2.2 es安装配置

#安装java
[root@es-node1 ~]# yum install -y elasticsearch

#添加es源
[root@es-node1 ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
[root@es-node1 ~]# cat >> /etc/yum.repos.d/elk.repo << EOF
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
EOF

#安装es
[root@es-node1 ~]# yum -y install elasticsearch --enablerepo=elasticsearch

#配置es
[root@es-node1 ~]# grep -Ev "^#|^$" /etc/elasticsearch/elasticsearch.yml 
cluster.name: jms-cluster
node.name: es-node01
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 10.1.11.32
http.port: 9200
discovery.seed_hosts: ["10.1.11.32"]
cluster.initial_master_nodes: ["10.1.11.32"]

#启动es
[root@es-node1 ~]# systemctl enable elasticsearch
[root@es-node1 ~]# systemctl start elasticsearch

#测试es
[root@jumpserver-test ~]# curl http://10.1.11.32:9200
{
  "name" : "es-node01",
  "cluster_name" : "jms-cluster",
  "cluster_uuid" : "w_wbn7GHQWybqg40Swff7w",
  "version" : {
    "number" : "7.17.7",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "78dcaaa8cee33438b91eca7f5c7f56a70fec9e80",
    "build_date" : "2022-10-17T15:29:54.167373105Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

2.3 JS对接ES

2.3.1 对接es

image-1669084510609
image-1669084726261

2.3.2 测试es

image-1669084772533
image-1669084789765

2.3.3 使用es

image-1669084832924
image-1669084867817

2.3.4 测试对接

image-1669085101203
image-1669085159713

文章目录
其他资源