108.elasticsearch安装

发表于 linux 分类,标签:
elasticsearch
1.官网下载包
https://www.elastic.co/cn/downloads
2.解压并修改配置文件
tar -zxvf elasticsearch-7.10.2.tar.gz -C /opt
cd /opt/elasticsearch-7.10.2/config
3.修改配置文件
vim /opt/elasticsearch-7.10.2/config/elasticsearch.yml
#增加以下配置
cluster.name: my-application
node.name: es-master
#node.master: true
#node.data: true
#bootstrap.memory_lock: true
path.data: /usr/local/elastcsearch-7.10.2/data
path.logs: /usr/local/elastcsearch-7.10.2/logs
network.host: 0.0.0.0
http.port: 9200
#transport.tcp.port: 9300
#discovery.seed_hosts: ["192.168.200.130:9300", "192.168.200.130:9301","192.168.200.130:9302"]
cluster.initial_master_nodes: ["es-master"]
#http.cors.enabled: true
#http.cors.allow-origin: "*"
#node.max_local_storage_nodes: 3   # 这个配置限制了单节点上可以开启的ES存储实例的个数,我们需要开多个实例,因此需要把这个配置写到配置文件中,并为这个配置赋值为2或者更高
#discovery.zen.minimum_master_nodes: 3   #设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点。默认为1,对于大的集群来说,可以设置大一点的值(2-4)
4.新建log目录及elk用户
mkdir -p /usr/local/elastcsearch-7.10.2/data
mkdir -p /usr/local/elastcsearch-7.10.2/logs
useradd elk
passwd elk
chown -R elk:elk /usr/local/elastcsearch-7.10.2
chown -R elk:elk /opt/elasticsearch-7.10.2/
5.修改以下配置文件
vim /etc/security/limits.conf
#增加
elk soft nofile 65536
elk hard nofile 65536
elk soft nproc 4096
elk hard nproc 4096
vim /etc/security/limits.d/20-nproc.conf
#修改
elk        soft    nproc     4096
root       soft    nproc     unlimited
vim /etc/sysctl.conf
#增加
vm.max_map_count = 655360
6.启动
切换elk用户
/opt/elasticsearch-7.10.2/bin/elasticsearch -d

docker安装
1.修改镜像源
vim /etc/docker/daemon.json
2.拉取镜像
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.2
3.启动
docker run -d --name es_master -p 8200:9200 -p 8300:9300 -v /data/elasticsearch/config:/usr/share/elasticsearch/config -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.10.2
4.elasticsearch.yal
#修改
cluster.name: "docker-cluster"
network.host: 0.0.0.0
transport.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"


0 篇评论

发表我的评论