ElasticSearch 安装及集群的部署配置
ElasticSearch安装
-
使用ES软件安装
[root@centos7 download]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.3-linux-x86_64.tar.gz [root@centos7 download]# tar -zxvf elasticsearch-7.13.3-linux-x86_64.tar.gz -C <软件目录路径>
-
使用Yum源安装ES 下载安装ES公用Key
[root@centos7 download]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
创建elasticsearch yum源文件并安装elasticsearch
[root@CentOS-7 ~]# vim /etc/yum.repos.d/es.repo [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md [root@CentOS-7 ~]# yum install --enablerepo=elasticsearch elasticsearch -y
配置ES集群
ES集群配置
[root@centos7 elasticsearch]# cat elasticsearch.yml |grep -v ^# # 定义ES集群名称 cluster.name: my-esCluster # 配置集群内同时启动的数据任务个数(默认值:2) cluster.routing.allocation.cluster_concurrent_rebalance: 16 # 配置添加或删除节点及负载均衡时并发恢复的线程个数(默认值:4) cluster.routing.allocation.node_concurrent_recoveries: 16 # 配置初始化数据恢复时并发恢复线程的个数(默认值:4) cluster.routing.allocation.node_initial_primaries_recoveries: 16 # 配置ES节点名称 node.name: <ES节点名称> # 配置是否可以升级为主节点 node.master: true node.data: true path.data: /var/lib/elasticsearch path.logs: /var/log/elasticsearch # 配置节点的IP地址或主机名称 network.host: <ip> or <hostname> # 配置ES节点的服务端口 http.port: 9200 transport.tcp.port: 9300 # 配置ES集群的节点发现 discovery.seed_hosts: ["es-hostname:9300", "es-hostname:9300"] # 配置初始化一个新集群时选举的集群的Master cluster.initial_master_nodes: ["node-01","node-02",..] network.tcp.keep_alive: true network.tcp.no_delay: true transport.tcp.compress: true # 配置ES集群的跨域访问 http.cors.allow-origin: "*" http.cors.enabled: true http.max_content_length: 200mb
Linux系统相关配置
修改 /etc/security/limits.conf 添加如下内容:
elasticsearch soft nofile 65536 elasticsearch hard nofile 65536
修改 /etc/security/limits.d/20-nproc.conf 添加加配置如下:
* hard nproc 4096 elasticsearch soft nofile 65536 elasticsearch hard nofile 65536
修改 /etc/sysctl.conf 添加加如下配置:
vm.max_map_count=655360
上一篇:
IDEA上Java项目控制台中文乱码
