5.8.1.1-Elasticsearch-安装

优质
小牛编辑
122浏览
2023-12-01

1.1 修改系统配置

[root@node16 security]# vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096
[root@node16 security]# vim /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p

1.2 添加用户

[root@node16 ~]# groupadd es
[root@node16 ~]# useradd es -g es
[root@node16 ~]# passwd es
[root@node16 es]# tar -zxvf elasticsearch-6.4.0.tar.gz
[root@node16 es]# chown -R es:es elasticsearch-6.4.0
[root@node16 es]# su es
[es@node16 ~]$ vim /home/es/elasticsearch-6.4.0/config/elasticsearch.yml
cluster.name: my-application
discovery.zen.ping.unicast.hosts: 192.168.102.16
network.host: 192.168.102.16
[es@node16 ~]$ vim ~/.bashrc
export ES_HOME=/home/es/elasticsearch-6.4.0
PATH=$PATH:$ES_HOME/bin
[es@node16 ~]$ vim ~/.bashrc
[es@node16 ~]$ elasticsearch -d

2. elasticsearch-head

2.1 下载

[root@node16 es]# git clone https://github.com/mobz/elasticsearch-head.git

2.2 修改配置文件

vim elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"

2.3 安装 nodejs

[root@node16 config]# yum install nodejs
# 版本大于 6.0.0
[root@node16 config]# node -v

2.4 使用 node 安装 elasticsearch-head

npm install

2.5 node 运行 elasticsearch-head

npm run start

2.6 使用

  • 索引操作:创建索引、删除索引

    3. 分布式安装

    3.1 master 配置

    cluster.name: test
    node.name: master
    node.master: true
    network.host: $ip
    

    3.2 slave 配置

    cluster.name: test
    node.name: slave01
    network.host: $ip 
    http.port: 8200
    discovery.zen.ping.unicast.hosts: "$masterip"
    

4. Kibana 安装

[root@node16 es]# tar -zxvf kibana-6.4.0-linux-x86_64.tar.gz
[root@node16 es]# vim kibana-6.4.0-linux-x86_64/config/kibana.yml
server.host: "192.168.102.16"
elasticsearch.url: "http://192.168.102.16:9200"
[root@node16 es]# ./kibana-6.4.0-linux-x86_64/bin/kibana &

参考资料