ElasticSearch7.1.1安装

规划:三台机器 两台选主
10.231.132.XX: master
10.231.132.XX: data
10.231.132.XX: master

手动下载安装
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-x86_64.rpm
rpm -ivh elasticsearch-7.1.1-x86_64.rpm
自动创建 elasticsearch用户及elasticsearch用户组
passwd elasticsearch
chown -R elasticsearch:elasticsearch elasticsearch #修改文件所属用户为elasticsearch,所属用户组为elasticsearch

加入服务到Linux

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

–安装之前系统参数设置:

vim /etc/security/limits.conf

* soft nofile 100000  #可打开的文件句柄的最大数
* hard nofile 100000  #soft:软限制、hard:硬限制
* soft nproc 4096     #单个用户可用的最大进程数量
* hard nproc 4096
* soft memlock unlimited #可打开的文件描述符的最大数
* hard memlock unlimited #unlimited:无限制

vim /etc/sysctl.conf


net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv4.ip_local_port_range = 1024 65000
fs.file-max = 100000
vm.max_map_count = 262144  #JVM能开启的最大线程数
#vm.swappiness = 0   # 禁用 swap
//运行 sysctl -p 使修改的内核参数生效

创建自定义的目录,不使用默认的数据目录:

mkdir -p /data/elasticsearch
chown -R elasticsearch:elasticsearch /data/elasticsearch/

– 文件配置:
vi /etc/elasticsearch/elasticsearch.yml

cluster.name: ES_cluster
node.name: node0
node.master: true
node.data: false
node.ingest: false
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/log
bootstrap.memory_lock: true
network.host: 10.231.132.XX
http.port: 9200
transport.tcp.port: 9300
discovery.seed_hosts: ["10.231.132.XX","10.231.132.XX","10.231.132.XX"]
cluster.initial_master_nodes: ["10.231.132.XX"] 

– ES的内存设置:默认只有1G 其他的默认即可
vim /etc/elasticsearch/jvm.options
-Xms4g
-Xmx4g

–启动
/use/share/elasticsearch/bin/elasticsearch &
启动找不到jdk( /etc/sysconfig/elasticsearch 指定jdk路径)
访问http://10.X.X.XX:9200/
http://10.X.X.X:9200/_cat/nodes

–配置IK分词器(https://github.com/medcl/elasticsearch-analysis-ik)
切换elasticsearch用户
更改目录权限
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/

 ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
-> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
[=================================================] 100%   
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
-> Installed analysis-ik```
重启 OK

你可能感兴趣的:(ES)