CentOS 7.3下安装部署elasticsearch6.3.2详解
2018/10/11 18:49:04 来源:Linux社区 作者:Matbe

Elasticsearch简介

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文检索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

实验部署

1、实验所需组件及环境

1)JDK8以上环境
2)Centos7.3,IP地址:192.168.144.112
3)elasticsearch6.3.2

2、安装jdk8以上版本

yum install java -y
java -version 查看java版本

CentOS 7.3下安装部署elasticsearch6.3.2详解

3、部署elasticsearch6.3.2

tar zxvf elasticsearch-6.3.2.tar.gz -C /opt/

groupadd ela 创建ela组
useradd -g ela ela 创建ela用户,并且加入ela组
passwd ela 为ela用户设定登录密码
visudo(或者vim /etc/sudoers)

CentOS 7.3下安装部署elasticsearch6.3.2详解

chown -R ela.ela /opt/elasticsearch-6.3.2/
ls -l /opt/elasticsearch-6.3.2/

CentOS 7.3下安装部署elasticsearch6.3.2详解

su ela
[ela@localhost ~]$ cd /opt/elasticsearch-6.3.2/config/
[ela@localhost config]$ sudo vim elasticsearch.yml

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: abner   //打开设定es群集名称
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1      //es当前节点名称,用于区分不同节点
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /data/es-data    //修改数据目录,此目录为自定义,需要在root用户下创建,且属主属组更改为ela
#
# Path to log files:
#
path.logs: /var/log/elasticsearch  //日志目录位置,需自己创建,方式同上
                                   //yum安装则系统自定义,在软件版本或者系统升级时会被删除,所以建议修改
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: true   //elasticsearch官网建议生产环境需要设置bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0   //监听访问地址为任意网段
#
# Set a custom port for HTTP:
#
http.port: 9200   //服务监听端口
#

sudo mkdir -p /data/es-data
sudo mkdir -p /var/log/elasticsearch
sudo chown -R ela.ela /data/
sudo chown -R ela.ela /var/log/elasticsearch

[ela@localhost /]$ cd /opt/elasticsearch-6.3.2/bin/
[ela@localhost bin]$ ./elasticsearch 后面可以跟上-d后台执行

CentOS 7.3下安装部署elasticsearch6.3.2详解

4、启动发现异常情况以及处理方式

CentOS 7.3下安装部署elasticsearch6.3.2详解

-当发现如上图无法分配内存错误等,可执行如下操作。(需要在root用户权限下)

vim /etc/security/limits.conf

CentOS 7.3下安装部署elasticsearch6.3.2详解

* soft nofile 65536
* hard nofile 131072
ela soft memlock unlimited
ela hard memlock unlimited

CentOS 7.3下安装部署elasticsearch6.3.2详解

vim /etc/sysctl.conf

vm.max_map_count = 655360   //添加

sysctl -p

[ela@localhost abc]$ cd /opt/elasticsearch-6.3.2/bin/
[ela@localhost bin]$ ./elasticsearch

CentOS 7.3下安装部署elasticsearch6.3.2详解

netstat -ntap | grep 9200

tcp6       0      0 :::9200                 :::*                    LISTEN      2095/java

CentOS 7.3下安装部署elasticsearch6.3.2详解

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2018-10/154775.htm


9

本栏最新