博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ELK 5.x日志分析 (二) Elasticserach 5.2 安装
阅读量:6500 次
发布时间:2019-06-24

本文共 3491 字,大约阅读时间需要 11 分钟。

hot3.png

解压安装包到/opt/elasticsearch 目录下面

[root@s1-prod-it-web01 opt]# tree -L 1 elasticsearch/

elasticsearch/
├── bin
├── config
├── lib
├── LICENSE.txt
├── modules
├── NOTICE.txt
├── plugins
└── README.textile
由于 elasticsearch默认不能使用root用户启动,先创建用户

useradd elasticsearch 

授权主程序目录

chown -R elasticsearch:elasticsearch /opt/elasticsearch/

创建数据存储目录 mkdir -p /var/lib/elasticsearch

授权存储目录 chown -R elasticsearch:elasticsearch /var/lib/elasticsearch

创建日志保存目录 mkdir -p /var/log/elasticsearch

授权日志保存目 chown -R elasticsearch:elasticsearch /var/lib/elasticsearch

创建进程PID文件目录 mkdir -p /var/run/elasticsearch

授权进程PID文件目录 chown -R elasticsearch:elasticsearch /var/run/elasticsearch

加入的Systemd Service ,配置文件如下,为了方便应用,已经参考官方教程编辑好了

vim /usr/lib/systemd/system/elasticsearch.service

#################################################################

[Unit]

Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target

[Service]

Environment=ES_HOME=/opt/elasticsearch
Environment=CONF_DIR=/opt/elasticsearch/config
Environment=DATA_DIR=/var/lib/elasticsearch
Environment=LOG_DIR=/var/log/elasticsearch
Environment=PID_DIR=/var/run/elasticsearch
#EnvironmentFile=-/etc/sysconfig/elasticsearch

WorkingDirectory=/opt/elasticsearch

User=elasticsearch

Group=elasticsearch

ExecStartPre=/opt/elasticsearch/bin/elasticsearch-systemd-pre-exec

ExecStart=/opt/elasticsearch/bin/elasticsearch \

                                                -p ${PID_DIR}/elasticsearch.pid \
                                                --quiet \
                                                -Edefault.path.logs=${LOG_DIR} \
                                                -Edefault.path.data=${DATA_DIR} \
                                                -Edefault.path.conf=${CONF_DIR}

# StandardOutput is configured to redirect to journalctl since

# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process

LimitNOFILE=65536

# Specifies the maximum number of bytes of memory that may be locked into RAM

# Set to "infinity" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/sysconfig/elasticsearch
#LimitMEMLOCK=infinity

# Disable timeout logic and wait until process is stopped

TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process

KillSignal=SIGTERM

# Java process is never killed

SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143

SuccessExitStatus=143

[Install]

WantedBy=multi-user.target

# Built for distribution-5.2.2 (distribution)

##################################################################

重新加载Service 并加入开机启动,执行启动:

systemctl daemon-reload

systemctl enable elasticsearch.service && systemctl start elasticsearch.service

 

[root@s1-prod-it-web01 config]# curl -l http://localhost:9100

<html>
            <head><title>Node Exporter</title></head>
            <body>
            <h1>Node Exporter</h1>
            <p><a href="/metrics">Metrics</a></p>
            </body>
            </html>[root@s1-prod-it-web01 config]# curl -l http://localhost:9200
{
  "name" : "ALkP9Fh",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "M0mxBeOVS4u0jttbWoqLcg",
  "version" : {
    "number" : "5.2.2",
    "build_hash" : "f9d9b74",
    "build_date" : "2017-02-24T17:26:45.835Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

 

转载于:https://my.oschina.net/gibsonxue/blog/1517667

你可能感兴趣的文章
Word产品需求文档,已经过时了【转】
查看>>
dtoj#4299. 图(graph)
查看>>
关于网站的一些js和css常见问题的记录
查看>>
zabbix-3.4 触发器
查看>>
换用代理IP的Webbrowser方法
查看>>
【视频编解码·学习笔记】7. 熵编码算法:基础知识 & 哈夫曼编码
查看>>
spark集群安装部署
查看>>
MySql 查询表字段数
查看>>
mariadb 内存占用优化
查看>>
Centos7安装编译安装zabbix2.219及mariadb-5.5.46
查看>>
Visual Studio Remote Debugger(for 2005/2008) .net远程调试<转>
查看>>
怎么获得combobox的valueField值
查看>>
Console-算法[if,while]-一输入两个正整数m和n,求其最大公约数和最小公倍数
查看>>
浅谈网络协议(四) IP的由来--DHCP与PXE
查看>>
jre与jdk的区别
查看>>
全景图的种类
查看>>
git 维护
查看>>
jfinal框架下使用c3P0连接池连接sql server 2008
查看>>
Jfinal Generator 不需要生成带某个前缀的表名数组的方法
查看>>
struts2中使用标签操作静态方法等
查看>>