linux安装elasticSearch6.6.2

编程

服务一:

cd /opt/elasticsearch-6.6.2/config

vim elasticsearch.yml

# 当前master为主,加入其它slave(从节点主机)

cluster.name: rise-elk-cluster

node.name:

node-1

node.master:

true

network.host: 172.16.10.4

http.port: 9200

discovery.zen.ping.unicast.hosts: ["172.16.10.3", "172.16.10.4"]

gateway.recover_after_nodes: 2

 

服务二:

cd /opt/elasticsearch-6.6.2/config

vim elasticsearch.yml

# 当前slave为主

cluster.name: rise-elk-cluster

node.name:

node-2

node.master:

false

network.host: 172.16.10.3

http.port: 9200

discovery.zen.ping.unicast.hosts: ["172.16.10.3", "172.16.10.4"]

gateway.recover_after_nodes: 2

 

查看集群

curl http://172.16.65.4:9200/_cat/health?v

 

X-Pack认证(CA证书+密码)

 

6.3.X后默认带的license是basic的,不支持security这类商业特性。 你可以将license改为trial,但是只有30天的试用期;

6.4版本不需要安装x-pack,默认已内置安装组件

 

# 在/bin目录执行如下命令来生成CA证书。

./elasticsearch-certutil ca --ca-dn "CN=WolfBolin Elatic CA" --out /opt/elasticsearch-6.6.2/config/wolfbolin-elastic-ca.p12

 

# 在/bin目录执行如下命令来生成cert证书

./elasticsearch-certutil cert -ca /opt/elasticsearch-6.6.2/config/wolfbolin-elastic-ca.p12 --out /opt/elasticsearch-6.6.2/config/wolfbolin-elastic-certificates.p12

 

# 编辑vim elasticsearch.yml配置,重启elasticsearch服务

xpack.security.transport.ssl.enabled: true

xpack.security.transport.ssl.verification_mode: certificate

xpack.security.transport.ssl.keystore.path: /opt/elasticsearch-6.6.2/config/wolfbolin-elastic-certificates.p12

xpack.security.transport.ssl.truststore.path: /opt/elasticsearch-6.6.2/config/wolfbolin-elastic-certificates.p12

 

# 进入/bin/目录执行如下命令来生成密码

./elasticsearch-setup-passwords auto(自动生成)

./elasticsearch-setup-passwords interactive(手动设置)

 

问题

 

原因

1.(centos7)在【启动】bin>./elasticsearch 的时候

【报错】max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方案

sudo vi /etc/sysctl.conf 文件最后添加一行

vm.max_map_count=262144

sudo sysctl -p

 

原因

[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.initial_master_nodes: ["node-1"]

 

原因

由于ES新节点的数据目录data存储空间不足,导致从master主节点接收同步数据的时候失败,此时ES集群为了保护数据,会自动把索引分片index置为只读read-only;

修改Eleastisearch索引name对应的配置,取消单个索引只读状态,或修改了所有的索引只读状态(_all表示所有索引)

Elasticsearch exception [type=cluster_block_exception, reason=blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];]

解决方案

1 磁盘扩容,可在配置文件中修改ES数据存储目录,重启ES

2 放开索引只读设置,在服务器上通过curl工具发起PUT请求

采用第二种,在服务器上执行如下请求:

curl -XPUT -H "Content-Type: applica0tion/json" http://127.0.0.1:9200/_all/_settings -d "{"index.blocks.read_only_allow_delete": null}"

 

原因

ERROR: [1] bootstrap checks failed

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

# elasticsearch用户拥有的内存权限太小,至少需要262144

解决方案

在/etc/sysctl.conf文件最后添加一行

vi /etc/sysctl.conf

vm.max_map_count=262144

# 保存后执行

sysctl -p

 

 

 

以上是 linux安装elasticSearch6.6.2 的全部内容, 来源链接: utcz.com/z/516154.html

回到顶部