ElasticSearch部署,以及kibana安装

1.环境要求:centos 7 ,jdk ,安装elasticsearch之前必须要安装好jdk

2.安装完成后,通过rpm方式安装elasticsearch-5.6.4.rpm

3.rpm -ivh elasticsearch-5.6.4.rpm安装完成后,查看是否为自启动systemctl list-unit-files|grep elasticsearch

查看为disabled 为非自启动

那么如何来设置自启动呢?systemctl enable elasticsearch

a470cf830f2c90d917cc388c90896a6f7ba.jpg

启动之前为elasticsearch配置jdk

vim /etc/sysconfig/elasticsearch 中修改JAVA_HOME路径的路径

cf8ccf899fefb1c23cae8a30ce1915ac3c7.jpg

40d85b1233bba16665ed8e398acbf80e3a6.jpg

还没有完,接下来配置核心配置文件和数据存储位置以及日志

核心文件

/etc/elasticsearch/elasticsearch.yml

数据文件路径

/var/lib/elasticsearch/

日志文件路径e

/var/log/elasticsearch/elasticsearch.log

 

修改配置文件 

vim /etc/elasticsearch/elasticsearch.yml

修改yml配置的注意事项:

每行必须顶格,不能有空格

后面必须有一个空格

 

集群名称,同一集群名称必须相同

882d728e7cdc4139dd718918ebee76d2fa9.jpg

单个节点名称 

47768e34a8168cc03f5b046713db0adfce8.jpg

网络部分  改为当前的ip地址  ,端口号保持默认9200就行

266bd59f7857138362cf82b66cd8ef4d6fd.jpg

把bootstrap自检程序关掉

e65e86eaa24fdb59ca6b57ca81c79927d11.jpg

bootstrap.system_call_filter: false

 

 

自发现配置:新节点向集群报到的主机名

# ======================== 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: my-es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
# 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.19.129
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# 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]"]
#
discovery.zen.ping.unicast.hosts: ["liuyuan"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# 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

                                                                                     
  1. 修改linux配置

为什么要修改linux配置?

默认elasticsearch是单机访问模式,就是只能自己访问自己。

但是我们之后一定会设置成允许应用服务器通过网络方式访问。这时,elasticsearch就会因为嫌弃单机版的低端默认配置而报错,甚至无法启动。

所以我们在这里就要把服务器的一些限制打开,能支持更多并发。

 

问题1max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536] elasticsearch

原因:系统允许 Elasticsearch 打开的最大文件数需要修改成65536

解决:vi /etc/security/limits.conf

添加内容:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 65536

 

注意:“*” 不要省略掉

 

问题2max number of threads [1024] for user [judy2] likely too low, increase to at least [2048]  CentOS7.x  不用改

 

原因:允许最大进程数修该成2048

解决:vi /etc/security/limits.d/90-nproc.conf   

修改如下内容:

* soft nproc 1024

#修改为

 * soft nproc 2048

 

问题3max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144] CentOS7.x  不用改

原因:一个进程可以拥有的虚拟内存区域的数量。

解决:可零时提高vm.max_map_count的大小

命令:sysctl -w vm.max_map_count=262144

重启:reboot

curl http://192.168.19.129:9200访问

0acae08c32fe6efa9e5ffe267815ea3ed35.jpg

成功

 

安装kibana解压即可用

拷贝kibana-5.6.4-linux-x86_64.tar 到/opt下

解压缩

进入kibana主目录的config目录下

vim  kibana.yml

 

server.host: “你本机ip”

4b1e0e9549c7bb1c5c13a0700435ff36c3b.jpg

启动

68478b8bf86d5d4f41387a6105381b6bb12.jpg

这属于前台启动,不好,关闭后,kibana即退出。用nohup ./kibana & 来替代。

ctrl + c 后

看进程:s -ef ,kibana进程名字不叫kibana,没法查,可以这个命令查最后的

ce764899f3d5ca933b8c8672e10c619e9bd.jpg

浏览器访问:我的ip为192.168.19.129:5601访问kibana

https://192.168.19.129:5601/

kibana不能自启动,已亲测,重启后并不能访问,进入到姐以后的根目录的bin下执行nohup ./kibana & 就可以了

4917f6afa63cbec5706434ceed8e7dfed45.jpg

期间linux很卡cd /etc/elasticsearch

 vim jvm.options 

576b7b03c165fb6de1edc60f21ad3e9e814.jpg

虚拟机配置了2G内存,沾满了,不过还可以用,是因为swap,交换分区当内存用。

转载于:https://my.oschina.net/architectliuyuanyuan/blog/3085891

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值