elasticsearch 6.x (二) linux部署 kibana x-pack 安装

大家好,我是烤鸭:   

环境:

        linux Cent OS 7.3

        elasticsearch-6.2.4

1. 下载elasticsearch 

    https://www.elastic.co/downloads/elasticsearch

上面的网址直接下载的话,实在太慢了。官方还提供了另一种方式。

https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-targz.html 

如图。


wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz.sha512
shasum -a 512 -c elasticsearch-6.2.4.tar.gz.sha512 
tar -xzf elasticsearch-6.2.4.tar.gz
cd elasticsearch-6.2.4/ 
./bin/elasticsearch

2.  启动及常见问题

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

       2.1  创建es用户和用户组es,指定密码es,赋予权限。(/opt/elasticsearch/为es安装目录)

groupadd es
useradd es -g es -p es
chown -R es.es /opt/elasticsearch/

        2.2  切换es用户访问成功

su - es
./elasticsearch-6.2.4/bin/elasticsearch

         上一张启动成功的图:

         

         2.3  常见异常:

 异常2 : bound or publishing to a non-loopback address, enforcing bootstrap checks
                ERROR: [2] bootstrap checks failed
[1]: max file descriptors [65535] 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]     

          2.4   修改   limits.conf

vim /etc/security/limits.conf

          最后一行加:

* soft nofile 65536
* hard nofile 131072

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

        2.5  编辑权限

vim /etc/security/limits.d/xx-nproc.conf

最下面加上两行:

*   soft    nproc     2048
*   soft    nproc     4096

       2.6  修改配置文件

vi /etc/sysctl.conf
sysctl -p

如图:

        

        2.7  切换es用户,重新启动

su - es
cd /opt/elasticsearch/elasticsearch-6.2.4/bin
./elasticsearch

        后台启动:

./elasticsearch -d

        成功如图:       

        

        2.8   测试访问

        阿里云的服务器需要在安全组配置,端口开放才可以访问。

       

        2.9  yml配置

        可以看出来,上面的启动端口不是8200和8300,分享一下yml配置说明。    

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: yxd-es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# 设置充当master节点,默认为true
#
node.master: true  
#
# 设置不充当data节点,默认为true
#
node.data: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: ../data    #数据目录
#
# Path to log files:
#
path.logs: ../logs    #日志目录
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#设置为true来锁住内存。因为内存交换到磁盘对服务器性能来说是致命的,当jvm开始swapping时es的效率会降低,所以要保证它不swap
#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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.1    (服务器内网ip)
network.bind_host: 192.168.1.1     (服务器内网ip)
#
# Set a custom port for HTTP:
#
http.port: 9303    #设置对外服务的http端口,默认为9200
transport.tcp.port: 9393   # 设置节点间交互的tcp端口,默认是9300   # transport.publish_host: 127.0.0.1     # 发布集群中要连接到的节点的主机地址。默认为transport.host(如果设置)或network.publish_host# transport.bind_host: 127.0.0.1    #将传输服务绑定到的主机地址。默认为transport.host(如果设置)或network.bind_host

# transport.publish_port: 9300    # 与此节点通信时,群集中其他节点应使用的端口。当群集节点位于代理或防火墙之后并且transport.tcp.port不能从外部直接寻址时很有用。默认为通过分配的实际端口 transport.tcp.port#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#这提供了自动集群体验,而无需进行任何配置。数组设置或逗号分隔的设置。每个值的形式应该是host:port或host  
#(如果没有设置,port默认设置会transport.profiles.default.port 回落到transport.tcp.port)。  
#请注意,IPv6主机必须放在括号内。默认为127.0.0.1, [::1]  
discovery.zen.ping.unicast.hosts: ["内网ip:9393"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

    2.10  调整jvm内存

vim /opt/elasticsearch/elasticsearch-6.2.4/config/jvm.options

    #默认是1g官方建议对jvm进行一些修改,不然很容易出现OOM,参考官网改参数配置最好不要超过内存的50%    

-Xms1g  
-Xmx1g

      2.11  更多关于多节点配置yml

        请参考:    https://blog.csdn.net/qq_34021712/article/details/79342668

         配置文件中给出了三种配置高性能集群拓扑结构的模式,如下: 
            # 1. 如果你想让节点从不选举为主节点,只用来存储数据,可作为数据节点 
            # node.master: true 
            # node.data: false
            # node.ingest: true

            # 2. 如果想让节点成为主节点,且不存储任何数据,并保有空闲资源,可作为协调器 
            # node.master:true 
            # node.data:false 
            # node.ingest:false 

            # 3. 如果想让节点既不称为主节点,又不成为数据节点,那么可将他作为摄取节点,从节点中获取数据,生成搜索结果等 
            # node.master: false 
            # node.data: false 
            # node.ingest: true

            # 4. 仅作为协调器 
            # node.master: false 
            # node.data: false

            # node.ingest: false

3.    x-pack安装

      官方安装网址:   

        https://www.elastic.co/cn/downloads/x-pack

        就按照官方的来就行。

bin/elasticsearch-plugin install x-pack

        

        3.1  启动访问,会提示输入用户名密码就成功了。

./bin/elasticsearch

        

        3.2    初始化x-pack用户名,密码

bin/x-pack/setup-passwords auto

        用户名   和  密码 如图:

        

4.    kibana和x-pack安装

        官方安装网址:      https://www.elastic.co/cn/downloads/kibana

        4.1    wget方式安装

wget https://artifacts.elastic.co/downloads/kibana/kibana-6.2.4-linux-x86_64.tar.gz
shasum -a 512 kibana-6.2.4-linux-x86_64.tar.gz 
tar -xzf kibana-6.2.4-linux-x86_64.tar.gz
cd kibana-6.2.4-linux-x86_64/ 

         4.2    修改配置文件/config/kibana.xml

 elasticsearch.url: "http://xxxxx:9303"        #es的ipelasticsearch.username: "elastic"elasticsearch.password: "changme"server.host: "127.0.0.1"  #kibana的启动ip  server.port: 9399    #kibana的启动端口

        4.3   启动(9399端口)

./bin/kibana

       


        4.4   访问,用户名,密码就是刚才elastic的用户名和密码


        首页:


        4.5  kibana的x-pack安装

cd /opt/elasticsearch/kibana/kibana-6.2.4-linux-x86_64
bin/kibana-plugin install x-pack

        4.3   带x-pack启动

        

        可以看到比刚才多了monitoring选项,可以检测es的节点等情况。

        过期时间是一个月以后。快要过期的话,就再去注册x-pack,每次注册可以使用一年。

        注册网址:    https://register.elastic.co/xpack_register


ps:

1.    关于集群多节点配置x-pack。每个节点都需要安装x-pack。但是kibana只需要安装一次。

2.    x-pack的密码修改。(需要指定content-type)

curl -H "Content-Type: application/json" -XPUT -u elastic -p '内网ip:9303/_xpack/security/user/elastic/_password' -d '{ "password" : "密码"}'


    如果忘记elastic用户的密码,可以再创建一个用户超级角色的用户(用户admin,密码admin1)

bin/x-pack/users useradd admin -p admin1 -r superuser 

    上面的请求改一下:

curl -H "Content-Type: application/json" -XPUT -u admin -p '内网ip:9303/_xpack/security/user/elastic/_password' -d '{ "password" : "密码"}'

会弹出让你输入密码:输入admin1就可以完成密码修改了。








更多关于elasticsearch 6.x内容:

    1.   elasticsearch 6.x 部署 windows入门(一) spingboot连接


        

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

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

相关文章

Kali Linux ——在无网络情况下安装无线网卡驱动

1、背景: 今日刚刚开始学习kali linux,众所周知,安装完成后,系统是没有无线网卡驱动的,这就对学生党造成相当的困扰:校园网要连接有线是需要认证客户端的,而认证客户端只有windows端&#xff0c…

HADOOP_HOME and hadoop.home.dir are unset 报错处理

一般是windows才会出现这个问题 请看下面的解决方案: 第一步:下载winutils-master.zip Gitee地址:https://gitee.com/nkuhyx/winutils.git 蓝奏云:https://www.lanzoux.com/i55ccnc Github地址:https://github.com/cda…

[css] 你是怎样对css文件进行压缩合并的?

[css] 你是怎样对css文件进行压缩合并的? 使用在线网站进行压缩,如http://tool.lu/css如使用Gulp,可使用gulp-minify-css进行压缩如使用WebPack,可使用optimize-css-assets-webpack-plugin进行压缩个人简介 我是歌谣,…

elasticsearch 6.x (三) linux 集群多节点部署

大家好,我是烤鸭:关于集群内单个节点部署,请参考上一篇文章。elasticsearch 6.x linux部署(二) kibana x-pack 安装环境:linux Cent OS 7.3elasticsearch-6.2.41. 下载多个es安装每个安装步骤都是一样的。2. 修改配置文件(重…

ztree改变节点颜色

//找到节点对象 var node ztree.getNodesByParam("id",aaaaaaaaaabbbbbb, null)[0]; if(node!null){//找到span标签,并改变颜色$("#"node.tId"_span").css("color",red); }

版本下载地址

http://chromedriver.storage.googleapis.com/index.html转载于:https://www.cnblogs.com/nvhanzhi/p/9887999.html

[css] css3和css2的区别是什么?

[css] css3和css2的区别是什么? css3增加了更多特性:动画、过渡效果,圆角、文字特效等个人简介 我是歌谣,欢迎和大家一起交流前后端知识。放弃很容易, 但坚持一定很酷。欢迎大家一起讨论 主目录 与歌谣一起通关前端…

springboot-devtools idea或eclipse 热加载

大家好&#xff0c;我是烤鸭&#xff1a;今天分享一下springboot项目的热加载。第二种方式在eclipse和idea中都可以。虽然会有一些小坑。 方式有两种&#xff1a; 1. springloaded(无效) <!-- https://mvnrepository.com/artifact/org.springframework/springloaded -->…

PostgreSQL创建数据库报错

ERROR:source database "template1"is being accessed by other users DETAIL:There are 2 other sessions using the database. 解决方案&#xff1a; CREATE DATABASE 数据库名称 WITH OWNER postgres ENCODING UTF8 TABLESPACE pg_default LC_COLLATE en_US.…

[css] 你知道什么是流体排版吗?说说它的原理是什么?

[css] 你知道什么是流体排版吗&#xff1f;说说它的原理是什么&#xff1f; 在文档流中&#xff0c;内联元素按内联方向显示&#xff0c;即词语在依据文件写作模式的句子中表示的方向。块元素则一个接一个地显示&#xff0c;就像该文档的写作模式中的段落一样。因此在流体排版…

java统计报表日期工具类

package com.test.common;import com.coyee.core.util.DateUtil;import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.*;/*** 时间工具类*/ public class DateUtils {/*<option value"today">今天</option><option valu…

springboot mybatis 热加载mapper.xml文件(最简单)

大家好&#xff0c;我是烤鸭: 今天介绍一下springboot mybatis 热加载mapper.xml文件。 本来不打算写的&#xff0c;看到网上比较流行的方式都比较麻烦&#xff0c;想着简化一下。 网上流行的版本。 https://www.cnblogs.com/oskyhg/p/8587701.html 总结一下需要&#xff1a;my…

vue cli vue 3.x

vue cli & vue 3.x https://cli.vuejs.org/dev-guide/ui-api.html#ui-api https://cli.vuejs.org/zh/guide/#cli vue cli & how to select the option in cmd ? vue cli & 选中 option a select all & i select all 1,2,3,4,5,6,7,8,9,0 分别对应 order 转载…

[css] 如果css文件过大时,如何异步加载它?

[css] 如果css文件过大时&#xff0c;如何异步加载它&#xff1f; 分割成多个CSS文件进行Gzip压缩link preload个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易&#xff0c; 但坚持一定很酷。欢迎大家一起讨论 主目录 与歌谣一起通关前端面试题

jenkins svn/git sonarqube scanner 代码集成测试

大家好&#xff0c;我是烤鸭&#xff1a;今天分享一个代码检测工具sonar&#xff0c;在jenkins集成的时候使用。 环境:sonarqube 7.1jenkins 2.12xsonarqube scanner &#xff08;官网最新版3.2.0.1227&#xff09;1. jenkins svn/git 搭建项目https://blog.csdn.net/Angry…

[css] 你有使用过字体图标吗?它有什么好处?

[css] 你有使用过字体图标吗&#xff1f;它有什么好处&#xff1f; 代替图片&#xff0c;可以减少http请求次数&#xff0c;提高页面加载性能。个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易&#xff0c; 但坚持一定很酷。欢迎大家一起讨论 主目录…

Jqgried树形列表

**************************************Jqgrid树列表***************************************function initGrid_test() {//必要字段&#xff1a;id,name,level,parent,isLeaf,expandedvar topicjson{"response": [{"id": "1", "name&qu…

射频与微波测量之S参数

转自&#xff1a;https://www.cnblogs.com/lyh523329053/p/9128577.html S参数 S散射也叫散射参数。是微波传输中的一组重要参数。由于我们很难在高频率时测量电流或电压&#xff0c;因此我们要测量散射参数或 S 参数。这些参数用来表征RF 元件或网络的电气属性或性能&#xff…

JAVA构造对象的几种方式(构建器、构造器)

大家好&#xff0c;我是烤鸭&#xff1a;今天说一下初始化对象的几种方式&#xff1a;1. 多参数构造器2. 构建器3. 构造器后 get/set方法举个例子:这里有个机构entity&#xff0c;提供一个默认构造器 package com.xxx.xxx.modules.sys.entity;/*** 机构Entity* versi…

[css] 请说说你对vh、vw的理解以及它们的运用场景是什么?

[css] 请说说你对vh、vw的理解以及它们的运用场景是什么&#xff1f; vw: 100vw为视窗的宽度&#xff0c;即1vw是视窗宽度的1%vh: 100vh为视窗的高度&#xff0c;即1vh是视窗高度的1%运用场景图片查看大图&#xff1a;img { max-height: 90vh; }代替rem实现移动端布局个人简介 …