一、安装OpenSearch
1.禁用主机swap提高性能
sudo swapoff -a
2.增加OpenSearch可用的内存映射数量。
编辑sysctl配置文件
sudo vi /etc/sysctl.conf
在文件中添加一行来定义所需的值, 或者如果键存在,则更改值,然后保存您的更改。
vm.max_map_count=262144
使用sysctl重新加载内核参数
sudo sysctl -p
通过检查值来验证更改是否已应用
cat /proc/sys/vm/max_map_count
3.安装
a. 获取安装包
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.17.1/opensearch-2.17.1-linux-x64.tar.gz
b. 解压
tar zxvf opensearch-2.17.1-linux-x64.tar.gz -C /opt/
c.新建普通用户
useradd es
d.授权普通用户
chown -R es.es /opt/opensearch-2.17.1
e.切换用户并配置密码变量
su es
export OPENSEARCH_INITIAL_ADMIN_PASSWORD='OpenSearch!320'
f.执行安装脚本
/opt/opensearch-2.17.1/opensearch-tar-install.sh
g.编辑配置文件禁用ssl
编辑opensearch.yml配置文件
vi /opt/opensearch-2.17.1/config/opensearch.yml
node.name: node-1
plugins.security.ssl.http.enabled: false
h.重启OpenSearch
i.获取集群状态
curl -u 'admin:OpenSearch!320' http://127.0.0.1:9200
{"name" : "node-1","cluster_name" : "opensearch","cluster_uuid" : "w_5jLsJoTAGkOhANBu4NDQ","version" : {"distribution" : "opensearch","number" : "2.17.1","build_type" : "tar","build_hash" : "1893d20797e30110e5877170e44d42275ce5951e","build_date" : "2024-09-26T21:59:32.078798875Z","build_snapshot" : false,"lucene_version" : "9.11.1","minimum_wire_compatibility_version" : "7.10.0","minimum_index_compatibility_version" : "7.0.0"},"tagline" : "The OpenSearch Project: https://opensearch.org/"
}
二、安装OpenSearch-Dashboard
需要安装在Redhat8以上,glibc版本太低会启动不了
a. 获取安装包
wget https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.17.1/opensearch-dashboards-2.17.1-linux-x64.tar.gz
b. 解压
tar zxvf opensearch-dashboards-2.17.1-linux-x64.tar.gz -C /opt/
c.授权普通用户
chown -R es.es /opt/opensearch-dashboards-2.17.1
d.修改配置文件
vi /opt/opensearch-dashboards-2.17.1/config/opensearch_dashboards.yml
server.host: "192.168.113.165"
i18n.locale: "zh-CN"
opensearch.username: admin
opensearch.password: OpenSearch!320
e.启动OpenSearch-Dashboard
/opt/opensearch-dashboards-2.17.1/bin/opensearch-dashboards
f. 界面访问
http://192.168.113.165:5601