Elasticssearch 7.6.2单机版的安装配置

一 . Elasticssearch 7.6.2下载安装包

1.1.通过wget的方式下载安装包:

Elasticssearch 7.6.2的下载:wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz

1.2.相应的安装包:

kibana-7.6.2的下载:wget https://artifacts.elastic.co/downloads/kibana/kibana-7.6.2-linux-x86_64.tar.gz

logstash-7.6.2的下载:wget https://artifacts.elastic.co/downloads/logstash/logstash-7.6.2.tar.gz

1.3.自己下载的话,官方地址:https://www.elastic.co/cn/downloads/

Elasticssearch 7.6.2单机版的安装配置_第1张图片

Elasticssearch 7.6.2单机版的安装配置_第2张图片

 

1.4 ES 7.6.2 版本是2010年4月1日发布的,具体的升级有:

  https://www.elastic.co/guide/en/elasticsearch/reference/7.6/release-notes-7.6.2.html

二.  Elasticssearch 7.6.2 安装步骤

2.1 解压并重命名

  tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz

  mv elasticsearch-7.6.2 elasticsearch

2.2 目录结构

  • bin 启动脚本等
  • config 配置文件,jvm,es、log等
  • jdk 自带的jdk
  • lib jar依赖包
  • logs 日志文件
  • modules 模块
  • plugins 插件,默认是没有

2.3 jdk的安装配置

   查看自己的电脑是否安装了java环境,如果安装了就不用管(1.8或者1.8以上) ,没安装也没事,es从7开始自带jdk了,只需要配置下配置环境变量就可以:

    查看jdk版本命令:java -version

    配置jdk环境变量的文件:vim /etc/profile

如果当前自己安装的jdk版本比es自带的jdk版本低,启动es时会有提示,但可以运行:

future versions of Elasticsearch will require Java 11; your Java version from [/home/jdk1.8/jre] does not meet this requirement

2.4 修改配置文件

2.4.1  修改jvm内存:vim /home/elasticsearch/config/jvm.options,内存的大小可以结合自己的配置及需求修改,我这没改:

Elasticssearch 7.6.2单机版的安装配置_第3张图片

2.4.2  修改ES的最重要的配置:vim /home/elasticsearch/config/elasticsearch.yml:

Elasticssearch 7.6.2单机版的安装配置_第4张图片

Elasticssearch 7.6.2单机版的安装配置_第5张图片

以上操作都是在root用户下进行的;

2.5 常见的错误及解决方法

  2.5.1 必须新建用户名,Root直接启动会报错:

[root@query bin]# ./elasticsearch

future versions of Elasticsearch will require Java 11; your Java version from [/home/jdk1.8/jre] does not meet this requirement

[2020-04-03T03:34:48,832][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [query] uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:174) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.6.2.jar:7.6.2]

at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.6.2.jar:7.6.2]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.6.2.jar:7.6.2]

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.6.2.jar:7.6.2]

at org.elas

解决方法是:

   adduser elk

   passwd elk

加完“elk”用户后,启动ES必须切换到elk用户下再启动;

2.5.2 必须赋权限:

Exception in thread "main" java.nio.file.AccessDeniedException: /home/elasticsearch/config/jvm.options

at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)

at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)

at java.nio.file.Files.newByteChannel(Files.java:361)

at java.nio.file.Files.newByteChannel(Files.java:407)

at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)

at java.nio.file.Files.newInputStream(Files.java:152)

at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:64)

解决方法:(回到root下,给整个es解压文件目录)

    chown -R elk:elk elasticsearch

2.5.3 需要修改linux系统配置,否则会报以下的错误:

ERROR: [3] bootstrap checks failed

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

ERROR: Elasticsearch did not exit normally - check the logs at /home/elasticsearch/logs/my-application.log

解决方法:回到root用户下:

 su root  ,输入root的密码;

 vim /etc/security/limits.conf,在最后一行“# End of file”的前面加上以下配置

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4
*               soft    nofile          131070
*               hard    nofile          655360
*               soft    nproc           4096
*               hard    nproc           4096
# End of file

vim /etc/security/limits.conf,在最下面,加两行配置:

vm.max_map_count=655360
fs.file-max=655360

sysctl -p 使得配置生效

三.  登录web控制台

  登录web地址:http://ip:9200,出现以下的内容:

Elasticssearch 7.6.2单机版的安装配置_第6张图片

四.elasticsearch head插件的安装

4.1下载es haead插件

      https://github.com/mobz/elasticsearch-head/blob/master/crx/es-head.crx

4.2 在chrome上安装插件:

   遇见文件请参看我的另一篇文章《该扩展程序未列在 Chrome 网上应用店中,并可能是在您不知情的情况下添加的--解决方法》;

4.3 打开安装的es haead插件,并连接

 Elasticssearch 7.6.2单机版的安装配置_第7张图片

看到以上内容,插件安装成功!

 

你可能感兴趣的:(大数据,java)