centos 7 安装 elasticsearch-6.2.4

安装ES

mkdir /data/software/
tar xvf elasticsearch-6.2.4.tar.gz -C /data/software/
cd /data/software/
ln -sv elasticsearch-6.2.4/ elasticsearch

或者
rpm -ivh elasticsearch-6.2.4.rpm

安装JDK

tar xf jdk-8u172-linux-x64.tar.gz -C /usr/local/
cd /usr/local/
ln -sv jdk1.8.0_172/ jdk

cat /etc/profile.d/java.sh
JAVA_HOME=/usr/local/jdk
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:/usr/local/jdk/lib:/usr/local/jdk/jre/lib

java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
[root@IBG-DB2ES-cwP03 ~]# javac -version
javac 1.8.0_172

根据CPU、内存、磁盘大小配置ES

jvm.options
-Xms2g
-Xmx2g

mkdir /data/elasticsearch/data -p
mkdir /data/elasticsearch/log -p

chown elasticsearch.elasticsearch /data/elasticsearch/ -R

elasticsearch.yml

index.number_of_shards: 5
index.number_of_replicas: 1

discovery.zen.ping_timeout #控制maste
discovery.zen.fd.ping_timeout #结点是否脱离

cluster.name: ES_CLUSTER_TEST

#cluster.routing.allocation.disk.threshold_enabled: true
#cluster.routing.allocation.disk.watermark.low: 8gb
#cluster.routing.allocation.disk.watermark.high: 5gb

node.name: ES-166
node.data: true
node.master: true

path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/log

bootstrap.memory_lock: true
indices.breaker.total.limit: 70%
indices.breaker.fielddata.limit: 70%
indices.breaker.fielddata.overhead: 1.03
indices.breaker.request.limit: 40%
indices.breaker.request.overhead: 1

network.host: 192.168.1.166

transport.tcp.port: 9300
transport.tcp.compress: true

http.port: 9200
http.max_content_length: 100mb
http.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"

discovery.zen.ping.unicast.hosts: [ "192.168.1.163","192.168.1.165","192.168.1.166"]

discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 360s
discovery.zen.fd.ping_retries: 60
discovery.zen.fd.ping_interval: 10s
discovery.zen.ping_timeout: 60s

gateway.recover_after_nodes: 1
gateway.recover_after_time: 5m
gateway.expected_nodes: 2

action.destructive_requires_name: false

systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service

vim /etc/sysconfig/elasticsearch
JAVA_HOME=/usr/local/jdk
MAX_OPEN_FILES=65536
MAX_LOCKED_MEMORY=unlimited

/etc/init.d/elasticsearch start

vim /etc/security/limits.conf

elasticsearch soft nofile 655350
elasticsearch hard nofile 655350

elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited

MAX_LOCKED_MEMORY=unlimited

安装search-guard插件

/usr/share/elasticsearch/bin/elasticsearch-plugin install -b file:///root/search-guard-6-6.2.4-22.3.zip

#!/bin/bash/usr/share/elasticsearch/plugins/search-guard-6/tools/sgadmin.sh -cd /usr/share/elasticsearch/plugins/search-guard-6/sgconfig -cn ES_CLUSTER_TEST -icl --index searchguard -ks /etc/elasticsearch/sgadmin-keystore.jks -ts /etc/elasticsearch/truststore.jks -kspass 12345678 -tspass 12345678 -nhnv -h 192.168.1.165 -p 9300 --diagnose

相关文章
相关标签/搜索