Elasticsearch安装

环境信息:

Centos 7.2

elasticsearch-6.5.4

host111: 192.168.100.111

host112: 192.168.100.112

提示: 生产环境中ES最少部署三个节点,我是做测试,只部署了两个节点

一、安装JDK

mkdir -p /usr/java
tar zxvf jdk-8u181-linux-x64.tar.gz -C /usr/java/

在/etc/profile中添加JDK环境变量

export JAVA_HOME=/usr/java/jdk1.8.0_181
export CLASSPATH=$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin

执行下面的命令使配置生效

source /etc/profile

二、安装ES

1. 部署

useradd elastic
tar zxvf elasticsearch-6.5.4.tar.gz -C /home/elastic/
chown -R elastic:elastic /home/elastic
mkdir -p /data/elastic/
chown -R elastic:elastic /data/elastic

2. 配置

ES安装对操作系统配置有一些要求,所以需要修改系统参数。

1 修改/etc/security/limits.conf文件,添加下面的内容:

elastic soft nofile 65536
elastic hard nofile 65536
elastic soft memlock unlimited
elastic hard memlock unlimited

2 修改/etc/sysctl.conf文件,添加下面的内容:

fs.file-max = 655350
vm.max_map_count = 262144

执行sysctl -p使修改生效

3 配置elasticsearch.yml

host111中elasticsearch.yml配置如下:

cluster.name: fl-elastic-cluster
node.name: node1
path.data: /data/elastic
path.logs: /home/elastic/logs
bootstrap.memory_lock: true
network.host: 192.168.100.111
http.port: 9200
discovery.zen.ping.unicast.hosts: ["host111", "host112"]
discovery.zen.minimum_master_nodes: 1  # 配置为集群节点总数/2 + 1

host112中elasticsearch.yml配置如下:

cluster.name: fl-elastic-cluster
node.name: node2
path.data: /data/elastic
path.logs: /home/elastic/logs
bootstrap.memory_lock: true
network.host: 192.168.100.112
http.port: 9200
discovery.zen.ping.unicast.hosts: ["host111", "host112"]
discovery.zen.minimum_master_nodes: 1  # 配置为集群节点总数/2 + 1

3. 启动

host111和host112都执行下面的启动命令

su - elastic
cd bin
./elasticsearch -d

4. 验证

# curl host111:9200
{
  "name" : "node1",
  "cluster_name" : "fl-elastic-cluster",
  "cluster_uuid" : "96APt8LxTZ2220hsjdYhNg",
  "version" : {
    "number" : "6.5.4",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "d2ef93d",
    "build_date" : "2018-12-17T21:17:40.758843Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值