title: “安装opensearch”
createTime: 2021-11-30T19:13:45+08:00
updateTime: 2021-11-30T19:13:45+08:00
draft: false
author: “name”
tags: [“es”,“安装”]
categories: [“OpenSearch”]
description: “测试的”
说明
- 基于Elasticsearch7.10.2 的 opensearch-1.1.0
硬件服务器
- 10.168.2.87
- 10.168.2.88
- 10.168.2.89
1.环境准备 (每台都需要做)
1.1创建用户(root用户操作)
- useradd top
1.2 修改用户密码(root用户操作)
- passwd top
1.3 赋予用户sudo权限(root用户操作)
-
修改命令
chmod -v u+w /etc/sudoers sed -i 's#.*top.*##g' /etc/sudoers sed -i 's#root.*ALL=(ALL).*ALL#root ALL=(ALL) ALL \ntop ALL=(ALL) ALL#g' /etc/sudoers chmod -v u-w /etc/sudoers
1.4 安全limits文件限制
-
修改文件
vim /etc/security/limits.conf
-
增加的内容
* soft nofile 65536 * hard nofile 65536
最后几行加上 需要增加的部分
1.5 系统文件限制
-
修改文件
vim /etc/sysctl.conf
-
增加的内容
vm.max_map_count=655360
最后几行加上 需要增加的部分(最后几行加上)
1.6 载入指定配置
-
修改文件
[top@node85 .ssh]$ sudo sysctl -p [sudo] top 的密码: vm.max_map_count = 655360
-
结果如图
1.7 重启
-
执行命令
sudo reboot
2.opensearch安装参考
官网下载地址
2.1 下载安装包:
-
执行命令
mkdir /home/top/opensearch cd /home/top/opensearch wget http://10.168.2.60:35000/opensearch-1.1.0-linux-x64.tar.gz
3.OpenS安装
3.1 解压OpenS安装包
-
执行命令
cd /home/top/opensearch tar -xzvf opensearch-1.1.0-linux-x64.tar.gz
3.2 创建数据目录、日志目录
-
执行命令
mkdir /home/top/opensearch/data -p mkdir /home/top/opensearch/logs -p
3.3 删除安装包
-
执行命令
rm -rf opensearch-1.1.0-linux-x64.tar.gz ln -s opensearch-1.1.0/ opensearch
3.4分发配置及安装目录
-
执行命令
rsync -avl /home/top/opensearch u86:/home/top rsync -avl /home/top/opensearch u87:/home/top
-
或者
rsync -avl /home/top/opensearch top@10.168.2.86:/home/top/ rsync -avl /home/top/opensearch top@10.168.2.87:/home/top/
4. OpenS节点配置
4.1、 opensearch-master(10.168.2.85 )
-
cat /home/top/opensearch/opensearch/config/opensearch.yml
# ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: opensearch-cluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: opensearch-master node.master: true #专用的主节点 node.data: false # 不是子节点 node.ingest: false # 不是摄取节点 (通道) # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # path.data: /home/top/opensearch/data # # Path to log files: # path.logs: /home/top/opensearch/logs#将集群绑定到特定的 IP 地址 network.host: node85#为集群配置发现主机 discovery.seed_hosts: ["node86","node87","node88"] cluster.initial_master_nodes: opensearch-master #禁用安全 plugins.security.disabled: true#discovery.type: cluster
4.2、opensearch-d1 (10.168.2.86)
- cat /home/top/elasticsearch-7.10.2/config/elasticsearch.yml
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: opensearch-cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: opensearch-d1
node.master: true
node.data: true
node.ingest: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/top/opensearch/data
# Path to log files:
#
path.logs: /home/top/opensearch/logs#将集群绑定到特定的 IP 地址
network.host: node86#为集群配置发现主机
discovery.seed_hosts: ["node85","node87","node88"]
cluster.initial_master_nodes: opensearch-master
#禁用安全
plugins.security.disabled: true
4.3、opensearch-d2(10.168.2.87)
- cat /home/top/elasticsearch-7.10.2/config/elasticsearch.yml
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: opensearch-cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: opensearch-d2
node.master: true
node.data: true
node.ingest: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/top/opensearch/data
#
# Path to log files:
#
path.logs: /home/top/opensearch/logs#将集群绑定到特定的 IP 地址
network.host: node87#为集群配置发现主机
discovery.seed_hosts: ["node85", "node86","node88"]
cluster.initial_master_nodes: opensearch-master
#禁用安全
plugins.security.disabled: true
4.4、opensearch-c1 (10.168.2.88)
- cat /home/top/elasticsearch-7.10.2/config/elasticsearch.yml
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: opensearch-cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
# 协调节点
node.name: opensearch-c1
node.master: false
node.data: false
node.ingest: false# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/top/opensearch/data
#
# Path to log files:
#
path.logs: /home/top/opensearch/logs#将集群绑定到特定的 IP 地址
network.host: node88#为集群配置发现主机
discovery.seed_hosts: ["node85","node86","node87"]
cluster.initial_master_nodes: opensearch-master
#禁用安全
plugins.security.disabled: true
5. 启动OpenS集群
- 此操作需要在各个节点上运行
/home/top/opensearch/opensearch/bin/opensearch -d -p /home/top/opensearch/pid >/dev/null 2>&1 &
6. 检测是否启动完成集群
- [top@localhost ~]$ curl -X GET ‘http://10.168.2.85:9200/’
- {
“name”: “node85”,
“cluster_name”: “es-top”,
“cluster_uuid”: “v7M5HemdSvmFjVPhEAlhig”,
“version”: {
“number”: “7.10.2”,
“build_flavor”: “default”,
“build_type”: “tar”,
“build_hash”: “93d5a7f6192e8a1a12e154a2b81bf6fa7309da0c”,
createTime: 2021-11-30T19:13:45+08:00
updateTime: 2021-11-30T19:13:45+08:00
“build_snapshot”: false,
“lucene_version”: “8.9.0”,
“minimum_wire_compatibility_version”: “6.8.0”,
“minimum_index_compatibility_version”: “6.0.0-beta1”
},
“tagline”: “You Know, for Search”
} -
- 其他
根据当前机器的大小修改分配给es的内存
- 文件位置:vim /home/top/es/elasticsearch-7.10.2/config/jvm.options
-Xms1g =>修改成想要的内存数
-Xmx1g =>修改成想要的内存数