前期准备
- jdk8+
www.oracle.com/technetwork… - Elasticsearch7
www.oracle.com/technetwork…
wget下载: wget artifacts.elastic.co/downloads/e…
安装es
-
tar -zxvf elasticsearch-7.3.1-linux-x86_64.tar.gz
-
cd elasticsearch-7.3.1/config
-
vim elasticsearch.yml
#集群名称 cluster.name: my-application #节点名称 node.name: node-1 #是否有资格成为主节点,不是指当前节点就是主节点 可以理解为候选人 node.master: true #是否存储索引数据 node.data: true #分片数 index.number_of_shards: 5 #副本数量 index.number_of_replicas: 1 #配置文件存储路径 path.conf: /path/to/conf #索引数据的存储路径 path.data: /path/to/data #临时文件存储路径 path.work: /path/to/work #日志文件存储路径 path.logs: /path/to/logs #插件存储路径 path.plugins: /path/to/plugins #不进行内存交换 bootstrap.mlockall: true #linux or unix使用mlockall防止es内存被交换出去 bootstrap.memory_lock: true #对外开发地址 network.host: 0.0.0.0 #对外开放端口 http.port: 9200 #引导启动集群的主节点 cluster.initial_master_nodes: ["node-1"] gateway.recover_after_nodes: 1 -
useradd -d /usr/es/ -u es
-
chown -R es /usr/elasticsearch-7.3.1
-
#配置内存锁 echo " " >> /etc/security/limits.conf echo "#elasticsearch memlock dinghe add 20170828 " >> /etc/security/limits.conf echo "elasticsearch soft memlock unlimited" >> /etc/security/limits.conf echo "elasticsearch hard memlock unlimited" >> /etc/security/limits.conf #配置文件描述符 echo " " >> /etc/security/limits.conf echo "#limit dinghe add 20170828 " >> /etc/security/limits.conf echo "* soft nofile 65536" >> /etc/security/limits.conf echo "* hard nofile 65536" >> /etc/security/limits.conf #map_counter echo "#elasticsearch inti dinghe add 20170828" >> /etc/sysctl.conf echo "vm.max_map_count = 262144" >> /etc/sysctl.conf -
cd /usr/elasticsearch-7.3.1/bin
-
./elasticsearch 启动