CentOS7安装ElasticSearch-6.4.1

创建用户

1 创建 elasticsearch 用户组

  [root@localhost ~]# groupadd elasticsearch

2 创建用户 es 并设置密码为es

  [root@localhost ~]# useradd es

  [root @localhost  ~]# passwd es

3 用户es 添加到 elasticsearch 用户组

  [root@localhost ~]# usermod -G elasticsearch es

4 设置sudo权限

  [root@localhost ~]# visudo

在root ALL=(ALL) ALL 一行下面添加es用户 如下:

  es ALL=(ALL) ALL

下载安装包

官方的下载受限,提供国内源地址:https://thans.cn/mirror/elasticsearch.html

  wget https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-6.4.1.tar.gz

如果下载不了,在本机直接点击下载,再上传到Linux中

把文件解压到/usr/local中

 更改elasticsearch-6.4.1 文件夹以及内部文件的所属用户为es, 用户组组为elasticsearch

  [es@localhost local]$ sudo chown -R es:elasticsearch elasticsearch-6.4.1

ElasticSearch 配置

elasticsearch.yml 修改

  vi config/elasticsearch.yml

修改内容(没有就添加):

  cluster.name: my-application

  node.name: node-1

  network.host: 0.0.0.0 

  http.port: 9200

  bootstrap.memory_lock: false
  bootstrap.system_call_filter: false  

修改/etc/sysctl.conf 

  su root

  vi  /etc/sysctl.conf

添加内容:

  vm.max_map_count=262144

保存退出后,使用sysctl -p 刷新生效

修改文件/etc/security/limits.conf

  vi /etc/security/limits.conf

添加如下内容:

  * hard nofile 65536

  * soft nofile  65536
 
  * soft nproc  2048
  * hard nproc  4096
root用户,进入limits.d目录下修改配置文件
  vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
  * soft nproc 4096

启动 elasticsearch

完成上面配置修改后,切换到es 用户,目录切换到 elasticsearch/bin 安装目录下执行

 在浏览器输入localhost:9200 验证是否启动成功,如果浏览器输出如下信息,代表安装启动成功

{
  "name" : "mFOD5mO",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "r5AsFxb2S066AMV5bpX3wQ",
  "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"
}

猜你喜欢

转载自www.cnblogs.com/jassa/p/12554135.html
今日推荐