centos7环境下ELK部署之elasticsearch
es部署:es只能用普通用戶啟動
博客園首發,轉載請注明出處:https://www.cnblogs.com/tzxxh/p/9435318.html
一、環境準備:
安裝jdk1.8、創建普通用戶
二、安裝:
方法一:tar包的形式
1.登陸普通用戶
2.下載elasticsearch?tar包
3.解壓elasticsearch包
4.配置$ES_HOME/config 下的
elasticsearch.yml?
   cluster.name: TestELK
   node.name: spark7             ?#當前節點的hostname
   path.data: /home/xxh/elasticsearch/data    #數據目錄,自定義
   path.logs: /home/xxh/elasticsearch/data/log  ?#日志目錄,自定義
   network.host: 0.0.0.0
   http.port: 9200
   discovery.zen.ping.unicast.hosts: ["spark5","spark6", "spark7"]
   discovery.zen.minimum_master_nodes: 2   ?? #至少要發現集群可做master的候選節點數,向下取整
jvm.options?  #這個文件下的參數根據自己的服務器硬件條件進行配置
   -Xms512m
   -Xmx512m
5.啟動es
報錯:ERROR: [2] bootstrap checks failed
 [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
 [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
 解決:參考---http://www.cnblogs.com/sloveling/p/elasticsearch.html
 切換到root用戶
? 添加如下內容:
   * soft nofile 65536
   * hard nofile 65536
   * soft nproc 65536
   * hard nproc 65536
? 添加下面配置:
vm.max_map_count=262144
sysctl -p6.普通用戶啟動es
7.配置開機自啟(systemd的方式)
在/lib/systemd/system 目錄下新增一個service
vi /lib/systemd/system/es.service增加下面內容。 具體關于systemd參看:http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html
[Unit] Description=Elasticsearch Wants=network-online.target After=network-online.target[Service] Environment=JAVA_HOME=/usr/java/jdk1.8.0_91 Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:${JAVA_HOME}/bin User=xxh Group=common ExecStart=/home/xxh/elasticsearch-5.6.3/bin/elasticsearch LimitNOFILE=65536[Install] WantedBy=multi-user.target? 執行:
systemctl daemon-reload systemctl enable es.service systemctl start es.service?
?
方法二:yum安裝
1. 導入官方PGP-Key
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch?2. 建立下載rpm包的repo ?
vim /etc/yum.repos.d/elk.repo [elasticsearch-5.x] name=Elasticsearch repository for 5.x packages baseurl=https://artifacts.elastic.co/packages/5.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md?3. 安裝elasticsearch包
yum install elasticsearch -y4. 啟動es
systemctl daemon-reload systemctl start elasticsearch systemctl status elasticsearch 
啟動錯誤,需要:
  vi /lib/systemd/system/elasticsearch.service
添加:
  Environment=JAVA_HOME=/usr/java/jdk1.8.0_91
   Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:${JAVA_HOME}/bin
轉載于:https://www.cnblogs.com/tzxxh/p/9435318.html
總結
以上是生活随笔為你收集整理的centos7环境下ELK部署之elasticsearch的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 刺激战场下载不了苹果
- 下一篇: 刺激战场亚服下载教程
