yum方式安装ElasticSearch

x33g5p2x  于2021-03-14 发布在 ElasticSearch  
字(1.6k)|赞(0)|评价(0)|浏览(497)

参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html

创建repo存储库,由于官方源太慢,这里使用国内清华源

cat > /etc/yum.repos.d/elasticsearch.repo << EOF
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-7.x/
gpgcheck=0
enabled=1
EOF

#安装Elasticsearch:
yum install -y elasticsearch

修改配置文件

$ vi /etc/elasticsearch/elasticsearch.yml
network.host: 192.168.92.80
http.port: 9200
cluster.initial_master_nodes: ["192.168.92.80"]
discovery.seed_hosts: ["192.168.92.80"]

network.host 配置elasticsearch监听地址

http.port: 9200 配置elasticsearch监听端口

discovery.seed_hosts 配置集群节点列表,修改network.host为非默认地址时强制要求配置该参数

修改jvm参数

# cat /etc/elasticsearch/jvm.options 
## JVM configuration

-Xms1g
-Xmx1g

启动elasticsearch服务

systemctl enable --now elasticsearch

浏览器访问elasticsearch

http://192.168.92.80:9200

或者使用curl命令

$ curl 192.168.92.80:9200
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "_na_",
  "version" : {
    "number" : "7.6.2",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
    "build_date" : "2020-03-26T06:34:37.794943Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

相关文章

微信公众号

最新文章

更多