Linux系统下Elasticsearch 5.4.0安装

版权声明:转载请注明出处! https://blog.csdn.net/ywd1992/article/details/83781375

1、安装java环境(链接:https://pan.baidu.com/s/1sDXtxyZcp1msGII2UhdoFQ 提取码:fis9)

rpm -ivh jdk-8u191-linux-x64.rpm

配置java环境 vi /etc/profile,在最后添加以下配置:

#set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_191/
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

加载刚才设置的变量

source /etc/profile

2、安装ES(链接:https://pan.baidu.com/s/1AxnakUOPwFsv7o127U1ALg 提取码:3d0i)

rpm -ivh elasticsearch-5.4.0.rpm
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

3、ES配置

vim /etc/elasticsearch/elasticsearch.yml

配置信息:

角色区分:
node.master: false
node.data: true

cluster.name: test_one #集群名(唯一)
node.name: node-118 #节点名称(每个节点不同)
path.data: /data1/es/data #数据存储目录,可配置多个,用“,”隔开
path.logs: /data1/es/logs #日志存储目录
path.repo: ["/data1/es/backups"]
network.host: 192.168.0.103 #本机IP
http.port: 9200 #访问端口
discovery.zen.ping.unicast.hosts: ["192.168.0.103", "192.168.0.104", "192.168.0.105"] #集群中节点所在IP
cluster.routing.allocation.disk.watermark.low: "90%" #es所占数据盘容量的最大百分比
http.enabled: true    #head插件是否可在浏览器中查看
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.memory_lock: true
discovery.zen.minimum_master_nodes: 1   #最少主节点数

vim /usr/lib/systemd/system/elasticsearch.service

LimitMEMLOCK=infinity  #打开注释

vim /etc/sysconfig/elasticsearch

MAX_LOCKED_MEMORY=unlimited  #打开注释

4、相关目录创建

mkdir -p /data1/es/{data,logs,backups} 
chmod 777 -R /data1/es/*

重启ES

systemctl daemon-reload
systemctl restart elasticsearch.service

5、插件安装

ES默认插件目录

cd /usr/share/elasticsearch/plugins/

(1) ik插件(链接:https://pan.baidu.com/s/1fgd1XZ0SMwC-BLz9jY0uBw 提取码:321j)

tar -xvf ik.tar.gz
mv ik /usr/share/elasticsearch/plugins/

systemctl restart elasticsearch

(2)head插件可使用Chrome扩展
链接:https://pan.baidu.com/s/1tiLFEU8WsId2SnhkumWA5w 提取码:1tve

6、安装sshfs(链接:https://pan.baidu.com/s/1-9nx-rf_kbYcctoPvs-NKQ 提取码:ig90)

rpm -ivh fuse-libs-2.9.2-7.el7.x86_64.rpm  
rpm -ivh fuse-sshfs-2.5-1.el7.rf.x86_64.rpm --force --nodeps

7、数据还原

建立连接(backup_darren为数据)(所有节点)

sshfs [email protected]:/root/backup_darren/ /data1/es/backups/ -o allow_other

创建仓储(backup_yuweidong仓储名)(任意数据节点)

ES2.4
curl -XPUT http://192.168.0.101:9200/_snapshot/backup_yuweidong -d '{"type": "fs","settings":{"compress": true,"location": "/data1/es/backups"}}'

数据恢复(backup_yuweidong仓储名 test17101→backup_darren)

ES2.4
curl -XPOST http://192.168.0.101:9200/_snapshot/backup_yuweidong/test17101/_restore

猜你喜欢

转载自blog.csdn.net/ywd1992/article/details/83781375
今日推荐