ubuntu搭建Elasticsearch过程与问题

news2025/8/7 7:56:27

目录

一.下载Elasticsearh

二.解压 创建需要的文件目录

三.修改配置文件

四.遇到的问题

1.root账号启动问题

2.创建文件不授权切换到非root用户test的时候报错

3.启动最后还是报错

4.浏览器请求http://localhost:9200 报错:received plaintext http traffic on an https channel, closing connection Netty4HttpChannel


一.下载Elasticsearh

Download Elasticsearch | Elastic

自己下载的 8.0.0 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.0.0-linux-x86_64.tar.gz

 wget https://artifacts.elastic.co/downloads/logstash/logstash-8.0.0-linux-x86_64.tar.gz

二.解压 创建需要的文件目录

tar -zxvf elasticsearch-8.0.0-linux-x86_64.tar.gz 
mkdir /data/elasticsearch/data /data/elasticsearch/logs

chmod 777 /data/elasticsearch

三.修改配置文件

jvm.options 具体要不要添加不知道,看网上说要加就加,用的虚拟机所有用的1g,其他根据实际情况修改


################################################################
-Xms1g
-Xmx1g

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

elasticsearch.yml 下面的地址用的是第二点创建的地址,修改xpack.security.enabled: false,修改enabled: false 否则访问的时候时候报错,文章最后会列出来遇到的报错

# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /data/elasticsearch/data
#
# Path to log files:
#
path.logs: /data/elasticsearch/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.208.112
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1"]
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 18-11-2022 06:54:11
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["ubuntu"]

以上配置还不能正常请求

四.遇到的问题

1.root账号启动问题

[2022-11-18T14:57:35,662][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [ubuntu] 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:170) ~[elasticsearch-8.0.0.jar:8.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) ~[elasticsearch-8.0.0.jar:8.0.0]

解决办法:

adduser test
passwd test
chown -R test:test elasticsearch-8.0.0/
chmod 770 elasticsearch-8.0.0/

参考了:java.lang.RuntimeException: can not run elasticsearch as root_wkCaeser_的博客-CSDN博客

注意里面的第一种方法./elasticsearch -Des.insecure.allow.root=true

试过了不行报错如下,最后还是改成了切换用户启动 :

ERROR: D is not a recognized option

2.创建文件不授权切换到非root用户test的时候报错

 2022-11-18 15:04:53,121 main ERROR RollingFileManager (/data/elasticsearch/logs/elasticsearch_server.json) java.io.FileNotFoundException: 
 /data/elasticsearch/logs/elasticsearch_server.json (Permission denied) java.io.FileNotFoundException: /data/elasticsearch/logs/elasticsearch_server.json (Permission denied)

3.启动最后还是报错

ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /data/elasticsearch/logs/elasticsearch.log
[2022-11-18T15:08:24,009][INFO ][o.e.n.Node               ] [ubuntu] stopping ...
[2022-11-18T15:08:24,047][INFO ][o.e.n.Node               ] [ubuntu] stopped
[2022-11-18T15:08:24,047][INFO ][o.e.n.Node               ] [ubuntu] closing ...
[2022-11-18T15:08:24,058][INFO ][o.e.n.Node               ] [ubuntu] closed
[2022-11-18T15:08:24,060][INFO ][o.e.x.m.p.NativeController] [ubuntu] Native controller process has stopped - no new native processes can be started

解决办法:

vi /etc/security/limits.conf

追加以下内容:
* soft    nofile  65536
* hard    nofile  65536
* soft    nproc   4096
* hard    nproc   4096

注意:此文件修改后需要重新登录用户,才会生效

4.浏览器请求http://localhost:9200 报错:received plaintext http traffic on an https channel, closing connection Netty4HttpChannel

received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/[0:0:0:0:0:0:0:1]:9200

解决办法, 修改两个如下:

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

最后输入locahost:9200出现如下表示OK

 

 报错参考:Elasticsearch报错: received plaintext http traffic on an https channel, closing connection ..._zhangphil的博客-CSDN博客

Elasticsearch报错: received plaintext http traffic on an https channel, closing connection ..._zhangphil的博客-CSDN博客

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/15655.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【python】算法与数据结构作业记录分析

目录 算法与数据结构实验题 9.21 朋友圈 ★实验任务 ★数据输入 ★数据输出 输入示例 输出示例 代码实现 效果展示 算法与数据结构实验题 9.24 水杯 ★实验任务 ★数据输入 ★数据输出 输入示例 输出示例 代码实现 效果展示 算法与数据结构实验题 9.21 朋友圈 …

实验(四):LCD1602显示实验

一、实验目的与任务 实验目的: 1. 掌握LCD1602显示控制方法; 2. 掌握利用Proteus进行单片机控制系统的仿真及调试方法。 3. 掌握单片机开发板的使用。 任务: 1.根据要求编写程序,并写出原理性注释; 2. 将检查程序运行的…

Java入门项目——读书管理系统

Java简单实现读书管理系统一、前言二、思路及整体框架三、代码展示1.有关读书包(Book)2.有关用户包3.有关操作书的包一、前言 相信有很多小伙伴学习完了【JavaSE】基础语法,想知道自己到底学的怎么样,或则学完不知道这么把知识点…

JavaFX之Scene Builder的使用(开发一款GUI小工具原来这么简单)

文章目录一、前言二、JavaFX与Scene Builder下载三、Scene Builder的使用四、详细教学(示例)4.1 环境配置4.2 创建fxml文件以及Controller类文件4.3 自定义界面4.4 运行我们的程序五、拓展总结博主个人社区:开发与算法学习社区 博主个人主页&…

创建.gitignore文件并使用

创建 .gitignore文件 第一种方式 在项目根目录下直接创建一个文件,后缀改成 .gitignore 即可。 第二种方式 用git创建,到根目录下,执行 touch .gitignore,即可看见目录下已经出现了该忽略文件。 添加忽略规则 # 忽略所有以 …

httpOnly对于抵御Session劫持的个人小结

Ⅰ 什么是http only?起到什么防护作用? cookie中设置了HttpOnly属性,那么通过js脚本将无法读取到cookie信息,主要防护的攻击手段:XSS不能通过document对象直接获取cookie Ⅱ 怎么绕过http only的防护(三种&#xff…

5、CSS——三种样式和样式优先级、CSS中颜色设置方式、标签选择器和基本选择器的优先级

目录 一、行内样式 二、内部样式 三、外部样式 1、创建外部样式步骤 2、引入外部样式的两种方式 2.1 第一种 2.2 第二种 3、style标签内的注释符号 四、样式优先级 五、CSS中颜色设置方式 1、使用颜色的英文单词 2、使用十六进制表示法 3、使用rgb()表示法…

Redis分区/分片详解

分区/分片详解 分区是分割数据到多个Redis实例的处理过程,因此每个实例只保存key的一个子集。 如果只使用一个redis实例时,其中保存了服务器中全部的缓存数据,这样会有很大风险,如果单台redis服务宕机了将会影响到整个服务。解决的…

easyExcel不同版本按照模板导出

Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都存在一个严重的问题就是非常的耗内存,poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题,但POI还是有一些缺陷,比如07版Excel解压缩以及解压后存储都是在内存中完成的…

力扣(LeetCode)7. 整数反转(C++)

模拟 整数反转,需要一个中间变量 ansansans , 循环存入 xxx 的最低位 x%10x\%10x%10, 然后 xx/10x x/10xx/10 ,得到 xxx 新的最低位 。如果进入新的循环,ans10ans\times 10ans10 ,让上一次的 ansansans 十…

Makefile 基础(一) —— 自定义变量、预定义变量、自动变量

目录 一、自定义变量 1、定义变量 2、使用变量 3、修改变量的值 二、预定义变量 三、自动变量 一、自定义变量 1、定义变量 变量定义有两种方式,一种会在使用的时候递归展开,一种是直接赋值。两种定义方式如下: 递归展开&#xff1a…

Servlet的基本使用

目录 一、Servlet是什么 二、Servlet的基本使用 1、创建项目 2、引入依赖 3、创建目录 4、编写代码 5、打包程序 6、部署程序 7、验证程序 三、优化部署方式 1、安装Smart Tomcat 2、使用Smart Tomcat 四、使用Servlet时常见的错误 1、404 2、405 3、500 4、…

Linux文件目录之查看篇【cat、more、less、head、tail、>、>>】【简直不要太详细】

目录cat 查看文件内容morelessecho:将输入内容到控制台>指令和>>指令: >输出重定向 ,>>追加head:tailcat 查看文件内容 cat【选项】 【要查看的文件】 -n 显示行号 注意:cat只能浏览文件,并不能修…

第二章--应用层

2.1应用层协议原理 研发网络应用程序的核心是写出能够运行在不同的端系统和同构网络彼此通信的程序,将应用软件限制在端系统,从而促进大量的网络应用程序的迅速研发和部署。 2.1.1网络应用程序体系结构 应用程序的体系不同于网络的体系结构&#xff0c…

实验(二):单片机数据区传送程序设计

一、实验目的与任务 实验目的: 1. 掌握单片机C语言程序设计和调试方法; 2. 了解单片机RAM中的数据操作。 任务: 1.根据要求编写程序,并写出原理性注释; 2. 检查程序运行的结果,分析一下是否正确&#xff1…

leetcode 42.接雨水,leetcode 503. 下一个更大元素Ⅱ

“即使到不了远方,心中也要有远方的模样。” 文章目录1.leetcode 503. 下一个更大元素Ⅱ1.1 详细思路及步骤1.2 java版代码示例2.leetcode 42.接雨水2.1 详细思路及步骤2.2 java版代码示例1.leetcode 503. 下一个更大元素Ⅱ 1.1 详细思路及步骤 这题基本上和昨天总结…

GoWeb从无到有(读取配置文件、gin、gorm)

GoWeb从无到有 – 读取配置文件、gin、gorm 创建go项目,结构如下 1. golang读取配置文件 引入包 go get -u gopkg.in/ini.v1在main.go的同级目录创建config文件夹,在文件夹中创建配置文件 config.ini # 项目配置 [app] Port8010 # mysql配置 [mysql] …

C++初阶 Stack和Queue的介绍和使用

作者:小萌新 专栏:C初阶 作者简介:大二学生 希望能和大家一起进步 本篇博客介绍:本篇博客会简单的介绍STL中的栈和队列 本章目标 复习下栈这种数据结构特点知道怎么使用STL中的栈复习下队列这种数据结构的特点知道怎么使用STL中…

多功能螯合剂FAPI-04-NH2,FAPI04-氨基,含有DOTA配体显示出良好的药代动力学

NH2-FAPI-04产品描述: FAPI是FAP的特异性抑制剂。在这些FAPI中,含有DOTA配体(FAPI-04)的[68Ga]Ga-DOTA-FAPI-04 PET/CT能显示出良好的体内药代动力学,导致快速kidney​清除和注射后10分钟至3小时的低背景活性。不久之后,[68Ga]Ga-…

Mybatis+Mybatis-plus+SpringBoot整合(完整版)

文章目录一、Mybatis(一)Mybatis简介1、Mybatis历史2、Mybatis特性3、Mybatis下载4、和其它持久化层技术对比(二)搭建Mybatis1、MySQL不同版本的注意事项2、创建Maven工程1、引入依赖3、创建MyBatis的核心配置文件3.1、核心配置文…