ElasticSearch installation deployed on linux

A Installation Preparations
Installation Reference documents:

ELK official website: https://www.elastic.co/

ELK official website Documentation: https://www.elastic.co/guide/index.html

ELK Chinese manual: https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html

ELK Chinese community: https://elasticsearch.cn/

ELK-API :https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html

(1), planning the installation directory

  /usr/local

(2), downloads the installation package

ElasticSearch visit the official website address  https://www.elastic.co/

Download the specified version of the installation package: elasticsearch-6.6.0.tar.gz

(3), the installation package uploaded to the specified directory

     Via FTP tool to upload the installation package to the specified directory, or download in the server directory: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz

(4), extract the installation package

tar -zxvf elasticsearch-6.6.0.tar.gz -C /export/servers

(5), the installation directory rename

mv elasticsearch-6.6.0 elasticsearch

(6), modify the configuration file

Into the config file in the folder es installation directory, modify the file elasticsearch.yml

Revises Primary Coverage:

# Configure es cluster name, the default is elasticsearch, es es automatically discovers in the same network segment, if there are multiple clusters in the same network segment, you can use this property to distinguish between different clusters. 
cluster.name: My - ES 
# Name node 
node.name: Node - . 1 
stores path data set index # 
Path.Data: / usr / local / elasticsearch / Data 
storage path provided # log 
path.logs: / usr / local / elasticsearch / logs 
# set the current ip address of another node by specifying the same network segment will be added to the cluster 
network.host: 0.0 . 0.0 
# set http port external services 
http.port: 9200 
# set the cluster master node the initial list, you can automatically discover new nodes join the cluster nodes 
discovery.zen.ping.unicast.hosts: [ " 127.0.0.1 " , " 10.10.10.34:9200 "]

 

 Note:

  1, padded necessary directories

  mkdir -p /usr/local/elasticsearch/data

 

  mkdir -p / usr / local / elasticsearch / logs (directory may already exist, it must first determine clear)

 

  2、network.host: 0.0.0.0

  Elasticsearch modify the configuration to support external network access. In the browser, visit http: // xxxx: 9200 / (xxxx is the ip address of the server running elasticsearch) can be. Otherwise, it can be used in the machine.

 

II. When you start to solve the error

(1), at the root when the user starts the error

Because of security issues elasticsearch not to run directly by the root user, so to create a new user.

Specific operation is as follows:
  the useradd testuser
  the passwd testuser
re-enter the password twice (custom)
  for the user rights assigned

  chown -R testuser:testuser /usr/local/elasticsearch

Then use a user-initiated es: su testuser

  cd  /usr/local/elasticsearch

Start es command: bin / elasticsearch

(2), when the user starts the error testuser

Assign permissions to users

  chown -R testuser:testuser /usr/local/elasticsearch

Then use a user-initiated es: su testuser

  cd  /usr/local/elasticsearch

Start es command: bin / elasticsearch

(3), when the user starts the error testuser

The reason: Centos6 does not support SecComp, while ES default bootstrap.system_call_filter detection to true, resulting in detection failure led directly to the ES can not be started after the failure.

See: https://github.com/elastic/elasticsearch/issues/22899

solution:

在elasticsearch.yml中新增配置bootstrap.system_call_filter,设为false。

bootstrap.system_call_filter: false

 

(4)、在testuser用户下启动继续报错

  a、原因:无法创建本地文件问题,用户最大可创建文件数太小,解决方案:切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:

    vi /etc/security/limits.conf

  然后添加如下内容: 注意*不要去掉了

    * soft nofile 65536

    * hard nofile 131072

  注:* 代表Linux所有用户名称(比如 hadoop)

  需要保存、退出、重新登录才可生效。

  b、原因:最大虚拟内存太小,解决办法切换到root用户修改配置sysctl.conf:

   vi /etc/sysctl.conf 

  添加下面配置:

    vm.max_map_count=655360

  最后记得执行:

    sysctl -p

  然后,重新启动elasticsearch,即可启动成功。

 

三.测试

切换到testuser用户执行:

看到这个界面证明已经成功了,可以用浏览器访问ip:9200查看,会下载一个json文件打开如下:

 

至此Elasticsearch就安装完成了,当然这只是一台机器,如果有需要还可以搭成集群.

 

三.ES插件安装

1、安装head

elasticsearch-head是一个界面化的集群操作和管理工具,可以对集群进行傻瓜式操作。你可以通过插件把它集成到es(首选方式),也可以安装成一个独立webapp。
es-head主要有三个方面的操作:
  a、显示集群的拓扑,并且能够执行索引和节点级别操作
  b、搜索接口能够查询集群中原始json或表格格式的检索数据
  c、能够快速访问并显示集群的状态
有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果; 
请求方法(get、put、post、delete),查询json数据,节点和路径
      支持JSON验证器
      支持重复请求计时器
      支持使用javascript表达式变换结果
收集结果的能力随着时间的推移(使用定时器),或比较的结果,能力图表转换后的结果在一个简单的条形图(包括时间序列)

  1), 直接安装

./bin/plugin install mobz/elasticsearch-head

       2) ,zip包安装

1. https://github.com/mobz/elasticsearch-head下载zip 解压
2. 建立elasticsearch-2.4.0\plugins\head文件
3. 将解压后的elasticsearch-head-master文件夹下的文件copy到head
4. 运行es

   安装验证: 

 2, 安装其他插件

 
$ ${ES_HOME}/bin/plugin --install lukas-vlcek/bigdesk
# 安装完成访问:http://localhost:9200/_plugin/bigdesk/#nodes

$ ${ES_HOME}/bin/plugin -install royrusso/elasticsearch-HQ
# 安装完成访问:http://localhost:9200/_plugin/HQ/

$ ${ES_HOME}/bin/plugin -install lmenezes/elasticsearch-kopf
# 安装完成访问:http://localhost:9200/_plugin/kopf/#!/cluster

 

Guess you like

Origin www.cnblogs.com/socketqiang/p/11363024.html