安装elasticsearch

elasticsearch 目录结构

type description location
home Home of elasticsearch installation /usr/share/elasticsearch
bin Binary scripts including elasticsearch to start a node /usr/share/elasticsearch/bin
conf Configuration files elasticsearch.yml and logging.yml /etc/elasticsearch
conf Environment variables including heap size,file descriptors /etc/default/elasticsearch
data The location of the data files /var/lib/elasticsearch/
logs Log files location /var/log/elasticsearch
plugins Plugin files location /usr/share/elasticsearch/plugins

下载地址

2.4.1

window7

bin目录执行安装

1
2
3
4
F:\ELK\elasticsearch-2.4.1\bin>service install
Installing service : "elasticsearch-service-x64"
Using JAVA_HOME (64-bit): "F:\java\jdk8"
The service 'elasticsearch-service-x64' has been installed.

安装成功,如果启动失败(进logs目录,查看错误信息)

1
2
[error] [ 6376] Failed creating java %JAVA_HOME%\jre\bin\server\jvm.dll
[error] [ 6376] 系统找不到指定的路径。

直接利用管理服务

1
2
 #运行 service manager 会弹出服务管理界面 修改jvm指定路径
F:\ELK\elasticsearch-2.4.1\bin>service manager

debian8

1
2
sudo dpkg -i  elasticsearch-2.4.2.deb
bin$> ./elasticsearch #启动提示没有权限

需要授权执行命令 chmod +x bin/elasticsearch
再次执行 ./elasticsearch -d 即可后台启动
使用 ps aux|grep elasticsearch 可以查看是否启动

设置开机启动
创建脚本 start.sh

1
2
3
4
5
6
7
8
9
10
11
#!bin/bash
export JAVA_HOME=/usr/bin/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#切换到cs用户(带环境变量)
su -cs<<!
cd /opt/elasticsearch/bin
./elasticsearch &
exit
!

修改启动文件 mousepad /etc/init.d/elasticsearch

1
2
3
4
5
6
7
8
9
10
11
#!bin/bash
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-De.ion: starts the elasticsearch server
# De.ion: starts elasticsearch using start-stop-daemon
### END INIT INFO
sh /opt/elasticsearch/start.sh

7.17.1

elasticsearch-env

ssl

ssl.yml

1
2
3
4
5
6
7
8
9
10
11
instances:
- name: "es"
dns: ['es.org']
- name: 'kibana'
dns: ['kibana.es.org']
- name: 'logstash'
dns: ['l.es.org']
- name: 'fluentd'
dns: ['fluentd.es.org']
- name: 'fluent'
dns: ['fluent.es.org']
1
./bin/elasticsearch-certutil cert ca --pem --in ssl.yml --out certs.zip
1
2
3
4
5
❯ ./bin/elasticsearch-setup-passwords  interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#配置集群密码
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

xpack.security.http.ssl.key: /opt/ELK/elasticsearch-7.17.1/config/es/es.key
xpack.security.http.ssl.certificate: /opt/ELK/elasticsearch-7.17.1/config/es/es.crt
xpack.security.http.ssl.certificate_authorities: /opt/ELK/elasticsearch-7.17.1/config/ca/ca.crt

xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.key: /opt/ELK/elasticsearch-7.17.1/config/es/es.key
xpack.security.transport.ssl.certificate: /opt/ELK/elasticsearch-7.17.1/config/es/es.crt
xpack.security.transport.ssl.certificate_authorities: /opt/ELK/elasticsearch-7.17.1/config/ca/ca.crt

#用HTTPS方式访问es 先设置❯ ./bin/elasticsearch-setup-passwords interactive
xpack.security.http.ssl.enabled: true
点击打赏
文章目录
  1. 1. elasticsearch 目录结构
    1. 1.1. 2.4.1
      1. 1.1.1. window7
      2. 1.1.2. debian8
    2. 1.2. 7.17.1
      1. 1.2.1. ssl
载入天数...载入时分秒... ,