前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ES7.8安装教程

ES7.8安装教程

原创
作者头像
qingyun
修改2021-01-29 10:07:26
7460
修改2021-01-29 10:07:26
举报
文章被收录于专栏:实践记录

ES7.8集群部署

1.环境规划

IP地址

配置

服务

192.166.166.121

8C 32G

ES7.8 cerebro

192.166.166.122

8C 32G

ES7.8 kibana7.8

192.166.166.123

8C 32G

ES7.8 es_head

2.系统参数配置

ES所有节点服务器都执行如下配置

代码语言:javascript
复制
[root@localhost tencent]# vim /etc/security/limits.conf
#然后添加以下内容:
    *                soft     nofile          65535
    *                hard     nofile          65535
    *                soft     memlock         unlimited
    *                hard     memlock         unlimited
    
​
[root@localhost tencent]# vim /etc/sysctl.conf
添加如下内容:
​
vm.max_map_count = 655300
vm.dirty_ratio=10
vm.dirty_background_ratio=5
vm.dirty_writeback_centisecs=200
vm.vfs_cache_pressure=200
vm.dirty_expire_centisecs=6000
vm.swappiness=0
​
保存后执行如下命令:
[root@localhost tencent]#  sysctl -p
3.部署ES

ES所有节点服务器都执行如下配置:

代码语言:javascript
复制
创建目录以及es数据存储的目录
[root@localhost ~]# mkdir -p /tencent/data
上传部署包elasticsearch-7.8.0-linux-x86_64.tar.gz 到 /tencent目录下
解压部署包:
[root@localhost tencent]# tar -zxvf elasticsearch-7.8.0.tar.gz
4.修改配置文件

4.1 修改elasticsearch.yml

代码语言:javascript
复制
[root@localhost config]# pwd
/tencent/elasticsearch-7.8.0/config
[root@localhost config]# vim elasticsearch.yml
修改以下配置:(修改为当前121节点)
# 集群名称,三台集群名称保持一致
cluster.name: tencent_cms
# 节点名称,三台需要不同的名称
node.name: node-1
# 当前节点是否可以被选举为master节点,是:true、否:false
node.master: true
# 当前节点是否用于存储数据,是:true、否:false
node.data: true
# 数据存储地址
path.data: /tencent/data
# 日志存储地址
path.logs: /tencent/elasticsearch-7.8.0/logs
# 锁住物理内存,是:true、否:false
bootstrap.memory_lock: true
# 网关地址
network.host: 192.166.166.121
# 访问端口号
http.port: 9200
# es7.x 之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点
discovery.seed_hosts: ["192.166.166.121", "192.166.166.122", "192.166.166.123"]
# es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举master
cluster.initial_master_nodes: ["192.166.166.121", "192.166.166.122", "192.166.166.123"]
​
# 是否支持跨域,是:true,在使用head插件时需要此配置
http.cors.enabled: true
# "*" 表示支持所有域名
http.cors.allow-origin: "*"

然后复制elasticsearch.yml到122,123节点中覆盖原来的elasticsearch.yml

代码语言:javascript
复制
122节点的修改内容为:
# 节点名称,三台需要不同的名称
node.name: node-2
# 网关地址
network.host: 192.166.166.122

123节点修改内容为:
# 节点名称,三台需要不同的名称
node.name: node-3
# 网关地址
network.host: 192.166.166.123

4.2 修改 jvm.options

代码语言:javascript
复制
[root@localhost config]# pwd
/tencent/elasticsearch-7.8.0/config
[root@localhost config]# vim jvm.options
#按需修改内存即可:(经验为总内存的一半即可)
-Xms16g
-Xmx16g
5.启动ES

ES所有节点服务器都执行如下命令:

代码语言:javascript
复制
# 添加用户组、用户,设置密码
[root@localhost config]# groupadd es
[root@localhost config]# useradd es -g es -p es
[root@localhost config]# chown -R es:es /tencent/*

# 关闭防火墙(centos7)
[root@localhost elasticsearch-7.8.0]# systemctl stop firewalld

#启动服务
[root@localhost elasticsearch-7.8.0]# su es
[es@localhost elasticsearch-7.8.0]$ ./bin/elasticsearch -d
6.检查集群状态
代码语言:javascript
复制
[es@localhost elasticsearch-7.8.0]$ curl -X GET "http://192.166.166.121:9200/_cat/nodes?v"
ip              heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.166.166.123            5          63   0    0.00    0.02     0.05 dilmrt    -      node-3
192.166.166.121            6          60   0    0.00    0.03     0.05 dilmrt    -      node-1
192.166.166.122            6          66   0    0.00    0.02     0.05 dilmrt    *      node-2
[es@localhost elasticsearch-7.8.0]$ 
7.cerebro安装
代码语言:javascript
复制
[root@localhost tencent]# tar -zxvf cerebro-0.9.2.tgz
[root@localhost tencent]# cd cerebro-0.9.2/
[root@localhost cerebro-0.9.2]# ll
total 16
drwxr-xr-x. 2 es es   40 Sep 14 18:48 bin
drwxr-xr-x. 3 es es  103 Sep 15 13:15 conf
drwxr-xr-x. 2 es es 8192 Sep 14 18:48 lib
-rw-r--r--. 1 es es 2932 Jun 18 07:49 README.md
[root@localhost cerebro-0.9.2]# cd conf/
[root@localhost conf]# ll
total 20
-rw-r--r--. 1 es es 2642 Sep 15 13:15 application.conf
drwxr-xr-x. 3 es es   21 Sep 14 18:48 evolutions
-rw-r--r--. 1 es es 1245 Jun 18 07:49 logback.xml
-rw-r--r--. 1 es es  512 Jun 18 07:49 reference.conf
-rw-r--r--. 1 es es 5903 Jun 18 07:49 routes
[root@localhost conf]# vim application.conf 
修改以下内容:
# A list of known hosts
hosts = [
  {
    host = "http://192.166.166.121:9200"
    name = "tencent_cms"
  }
  # Example of host with authentication
  #{
  #  host = "http://some-authenticated-host:9200"
  #  name = "Secured Cluster"
  #  auth = {
  #    username = "username"
  #    password = "secret-password"
  #  }
  #}
]
开放端口
sudo firewall-cmd --zone=public --add-port=9500/tcp --permanent
sudo firewall-cmd --reload
以后台服务启动
[root@localhost cerebro-0.9.2]# ./bin/cerebro -Dhttp.port=9500 &
[1] 7781
[root@localhost cerebro-0.9.2]# [info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9500

访问网址:http://192.166.166.121:9500/#/overview?host=tencent_cms
8.es_head 安装
代码语言:javascript
复制
[root@localhost tencent]# tar -zxvf node-v14.0.0-linux-x64.tar.gz -C /usr/local/
[root@localhost tencent]# vim /etc/profile
#添加以下内容:
export NODE_HOME=/usr/local/node-v14.0.0-linux-x64
export PATH=$NODE_HOME/bin:$PATH
export NODE_PATH=$NODE_HOME/lib/node_modules
#执行并验证
[root@localhost tencent]# source /etc/profile
[root@localhost tencent]# node -v
v14.0.0
[root@localhost tencent]# npm -v
6.14.4
[root@localhost tencent]# tar -zxvf elasticsearch-head.tar.gz
[root@localhost tencent]# cd elasticsearch-head/
[root@localhost elasticsearch-head]# vim _site/app.js
修改以下内容: 在4374行把"http://192.166.166.129:9200" 替换为你的机器IP地址("http://192.166.166.123:9200")
4367         app.App = ui.AbstractWidget.extend({
4368                 defaults: {
4369                         base_uri: null
4370                 },
4371                 init: function(parent) {
4372                         this._super();
4373                         this.prefs = services.Preferences.instance();
4374                 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.166.166.123:9200";
4375                         if( this.base_uri.charAt( this.base_uri.length - 1 ) !== "/" ) {
4376                                 // XHR request fails if the URL is not ending with a "/"
4377                                 this.base_uri += "/";
4378                         }
4379                         if( this.config.auth_user ) {
4380                                 var credentials = window.btoa( this.config.auth_user + ":" + this.config.auth_password );
4381                                 $.ajaxSetup({
4382                                         headers: {
4383                                                 "Authorization": "Basic " + credentials
4384                                         }
4385                                 });
4386                         }


执行启动脚本:
[root@localhost elasticsearch-head]# pwd
/tencent/elasticsearch-head
[root@localhost elasticsearch-head]# ./eshead.sh 

客户端访问地址:http://192.166.166.123:9100/
9.kibana 安装
代码语言:javascript
复制
[root@localhost tencent]# tar -zxvf kibana-7.8.0-linux-x86_64.tar.gz
[root@localhost config]# pwd
/tencent/kibana-7.8.0-linux-x86_64/config
[root@localhost config]# vim kibana.yml
编辑文件config/kibana.yml ,配置属性:
server.port: 5601
server.host: "192.166.166.122"
elasticsearch.hosts: ["http://192.166.166.122:9200"]

开放端口
sudo firewall-cmd --zone=public --add-port=5601/tcp --permanent
sudo firewall-cmd --reload

启动:不能使用root用户
[root@localhost kibana-7.8.0-linux-x86_64]# su es
[es@localhost kibana-7.8.0-linux-x86_64]$ nohup bin/kibana >/dev/null 2>&1 &

访问地址:http://192.166.166.122:5601

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ES7.8集群部署
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档