elasticsearch7.6 安裝 並且開啟外網訪問,真的好累。


下載

下載頁面

https://www.elastic.co/cn/downloads/elasticsearch

 

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.1-linux-x86_64.tar.gz

 

 

 

寫在前面 因為es7.6 已經內置了jdk,所以機器不需要有java環境。如果機器有java環境,務必保持和es版本匹配的java環境

es 默認不能已root 用戶啟動

所以新建 es用戶

adduser es
passwd es

把es包移動到es用戶的工作目錄

mv elasticsearch-7.6.1-linux-x86_64.tar.gz /home/es

切換es 用戶

su es

解壓

tar -zxvf elasticsearch-7.6.1-linux-x86_64.tar.gz

啟動 es

./elasticsearch-7.6.1/bin/elasticsearch

配置外網可訪問

vim elasticsearch-7.6.1/config/elasticsearch.yml

修改

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
# ip 地址填寫 ip addr 出現的靜態IP
network.host: 172.17.0.15
#

重新啟動

ERROR: [2] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

解決

切換到root用戶
su root
echo "vm.max_map_count=262144" > /etc/sysctl.conf
sysctl -p

重新啟動

./elasticsearch-7.6.1/bin/elasticsearch

出現錯誤,要瘋了

[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

解決辦法

vim elasticsearch。yml

cluster.name: my-es
node.name: node-1
cluster.initial_master_nodes: ["node-1"]

重點是 node。name和cluster.initial_master_nodes 要設置

瀏覽器訪問ip:9200

{
  "name" : "node-1",
  "cluster_name" : "my-es",
  "cluster_uuid" : "hd06lHxERYqnq0hnN7eQSw",
  "version" : {
    "number" : "7.6.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "aa751e09be0a5072e8570670309b1f12348f023b",
    "build_date" : "2020-02-29T00:15:25.529771Z",
    "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"
}

公網終於可以了。

安裝插件

./elasticsearch-plugin install analysis-icu

 

 

訪問 ip:9200/_cat/plugins

node-1 analysis-icu 7.6.1

_cat api 提供了一些es 集群信息的接口。可以訪問 ip:9200/_cat來獲取查看

http://11111:9200/_cat

=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates

 一台機器 多節點啟動

./elasticsearch-7.6.1/bin/elasticsearch -E node.name=node1 -E cluster.name=es-cluster -E path.data=node1_data -d

./elasticsearch-7.6.1/bin/elasticsearch -E node.name=node2 -E cluster.name=es-cluster -E path.data=node2_data -d

./elasticsearch-7.6.1/bin/elasticsearch -E node.name=node2 -E cluster.name=es-cluster -E path.data=node2_data -d

如果出現 
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Not enough space' (errno=12)
    at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:123)
    at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:88)

需要去jvm.options,修改es啟動所需要的最大最小堆內存或者增大機器內存

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM