Elasticsearch installation and plug-in installed on Elasticsearch and plug linux on linux

https://www.cnblogs.com/yuanyongqiang/p/11867537.html

 

First, the preparatory work:

  Installation Reference document:

    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

Second, download and install ES:

  Download the installation package:

    ElasticSearch visit the official website address  https://www.elastic.co/cn/downloads/past-releases#elasticsearch

    Extracting installation package:

    tar -zxvf elasticsearch-5.2.0.tar.gz

  Modify the configuration file:

    Es installed into the main content of the config file directory folder, modify elasticsearch.yml file, modified:

Copy the code
# 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 
store the index data path provided # 
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 external services http port 
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"]
Copy the code

 

 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.

Third, resolve error at startup:

  (1), at the root startup given user, if the non-root, skip this step.
  

    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:

      In elasticsearch.yml the new configuration bootstrap.system_call_filter, set to false.

      bootstrap.system_call_filter: false

       

    (4), continue to start at testuser user error

      

      a, reason: Unable to create a local file problem, users can create a maximum number of files is too small Solution: Switch to the root user, limits.conf edit the configuration file, add something like the following:

        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文件打开如下:

    启动命令:

      cd /home/es/elasticsearch-5.2.0
      ./elasticesrarch -d 是后台运行
      ps -ef|grep elasticesrarch 查看进程号
      kill -9 5365 结束后台运行的es

     

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

五、插件安装

1、 安装head   

  5.x 版本后,安装 elasticsearch-head 这个插件需要很复杂的流程。各种踩坑后,我放弃了。转战谷歌浏览器的 elasticsearch-head-chrome 插件:

  

 

 

 

 

 

2、 安装kibana

  下载地址: https://www.elastic.co/cn/downloads/past-releases#kibana

  解压:tar -zxvf kibana-5.2.0-linux-x86_64.tar.gz

  进入文件夹: cd kibana-5.2.0-linux-x86_64

  然后到kibana安装目录的config下,编辑kibana.yml配置文件,添加如下配置:

1 #配置本机ip
2 server.host: "192.168.252.129"
3 #配置es集群url
4 elasticsearch.url: "http://192.168.252.129:9200"

 

  Kibana 启动:

    切换到kibana安装目录的bin目录下,执行kibana文件

          cd /usr/local/kibana/bin

          ./kibana &

        主要使用&命令启动后,退出当前窗口时需要使用exit退出

        成功启动后,可以访问:http:// 192.168.252.129:5601来访问kibana,ip为kibana安装节点ip,端口默认为5601,可以在config/kibana.yml中配置。

 

参考:

ES安装部分:https://www.cnblogs.com/socketqiang/p/11363024.html

Kibana安装部分: http://www.mamicode.com/info-detail-2617619.html

一、 准备工作:

  安装参考文档:

    ELK官网:https://www.elastic.co/

    ELK官网文档:https://www.elastic.co/guide/index.html

    ELK中文手册:https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html

    ELK中文社区:https://elasticsearch.cn/

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

二、 下载安装ES:

  下载安装包:

    访问elasticSearch官网地址 https://www.elastic.co/cn/downloads/past-releases#elasticsearch

    解压安装包:

    tar -zxvf elasticsearch-5.2.0.tar.gz

  修改配置文件:

    进入到es安装目录下的config文件夹中,修改elasticsearch.yml 文件,修改的主要内容:

Copy the code
#配置es的集群名称,默认是elasticsearch,es会自动发现在同一网段下的es,如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。
cluster.name: my-es
#节点名称
node.name: node-1
#设置索引数据的存储路径
path.data: /usr/local/elasticsearch/data
#设置日志的存储路径
path.logs: /usr/local/elasticsearch/logs
#设置当前的ip地址,通过指定相同网段的其他节点会加入该集群中
network.host: 0.0.0.0
#设置对外服务的http端口
http.port: 9200
#设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点
discovery.zen.ping.unicast.hosts: ["127.0.0.1","10.10.10.34:9200"]
Copy the code

 

 注:

  1、补齐必要的目录

  mkdir -p /usr/local/elasticsearch/data

  mkdir -p /usr/local/elasticsearch/logs     (目录可能已经存在,需先确定清楚)

  2、network.host: 0.0.0.0

  修改Elasticsearch的配置,使其支持外网访问。在浏览器中,访问http://xxxx:9200/(xxxx是运行elasticsearch的服务器的ip地址)即可。否则这可以在本机使用。

三、 解决启动时报错:

  (1)、在 root用户下启动时报错,如果非root用户,跳过此步骤。
  

    因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户。

    具体操作如下:
      useradd testuser
      passwd testuser
    再输入两次密码(自定义)
      为用户赋权限

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

    然后使用es用户启动  :su testuser

      cd  /usr/local/elasticsearch

    启动es命令:bin/elasticsearch

  (2)、在testuser用户下启动时报错

    为用户赋权限

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

    然后使用es用户启动  :su testuser

      cd  /usr/local/elasticsearch

    启动es命令:bin/elasticsearch

  (3)、在testuser用户下启动时报错

    

    原因:Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

    详见 :https://github.com/elastic/elasticsearch/issues/22899

    解决方案:

      在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文件打开如下:

    启动命令:

      cd /home/es/elasticsearch-5.2.0
      ./elasticesrarch -d 是后台运行
      ps -ef|grep elasticesrarch 查看进程号
      kill -9 5365 结束后台运行的es

     

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

五、插件安装

1、 安装head   

  5.x 版本后,安装 elasticsearch-head 这个插件需要很复杂的流程。各种踩坑后,我放弃了。转战谷歌浏览器的 elasticsearch-head-chrome 插件:

  

 

 

 

 

 

2、 安装kibana

  Download:  https://www.elastic.co/cn/downloads/past-releases#kibana

  Kai压: tar -zxvf kibana-5.2.0-linux-x86_64.tar.gz

  Into the folder: cd kibana-5.2.0-linux-x86_64

  Then to the next config kibana installation directory, edit kibana.yml configuration file, add the following configuration:

The machine 1 # Configure IP 
2 server.host: "192.168.252.129" 
. 3 # Configure es cluster URL 
. 4 elasticsearch.url: "http://192.168.252.129:9200"

 

  Kibana 启动:

    Switch to the bin directory kibana installation directory, file execution kibana

          cd /usr/local/kibana/bin

          ./kibana &

        The main use & command to start, you need to use the exit to exit when exiting the current window

        After a successful start, you can visit: http: // 192.168.252.129:5601 access kibana, ip ip is kibana node installation, the default port 5601, can be configured in config / kibana.yml in.

 

reference:

ES mounting portion: https://www.cnblogs.com/socketqiang/p/11363024.html

Kibana mounting portion:  http://www.mamicode.com/info-detail-2617619.html

Guess you like

Origin www.cnblogs.com/kelelipeng/p/12322409.html