elasticsearch安装使用

elasticsearch是支持Linux和window系统的,elasticsearch官网上最新的稳定版本是6,2,4,该版本不支持jdk8以下的,所以需要在你的系统下安装好jdk。
安装步骤:

1、下载elasticsearch的rpm包:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-x86_64.rpm

2. 安装elasticsearch

rpm install -y elasticsearch-7.4.2-x86_64.rpm

3. 启动

systemctl start elasticsearch
或者
/etc/init.d/elasticsearch start

4. 验证是否启动

运行
curl http://localhost:9200/
在PowerShell运行
Invoke-RestMethod http://localhost:9200

5.配置elasticsearch

[root@linux-node1 elasticsearch]# grep '^[a-Z]' /etc/elasticsearch/elasticsearch.yml
cluster.name: elk-cluster1 #集群名称
path.data: /elk/data/ # 配置路径
path.logs: /elk/logs/
node.name: elk-node1 #节点名称
network.host: 192.168.1.1 #配置本地IP地址获域名
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.1.1", "192.168.1.2"] #配置广播范围

6. 配置路径 问题解决

mkdir /elk
chown elasticsearch.elasticsearch /elk 给elk目录授权给elasticsearch
重启 systemctl restart elasticsearch

elasticsearch-head 配置使用

git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start & or grunt server &
open http://localhost:9100/

配置elasticsearch 允许elasticsearch-head连接elasticsearch

http.cors.enabled: true   # 开启http访问
http.cors.allow-origin: “*” # 可访问的IP地址

elasticsearch内存优化

查看elasticsearch状态

[root@linux-node1 ~]# ps -ef |grep elasticsearch
elastic+ 3964 1 2 10:58 ? 00:00:53 /bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+Us
eCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissi
onsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdo
wnHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/usr/share/elasticsearch -cp
/usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet -Edefault.path.logs=
/var/log/elasticsearch -Edefault.path.data=/var/lib/elasticsearch -Edefault.path.conf=/etc/elasticsearch
root 4083 1539 0 11:40 pts/0 00:00:00 grep --color=auto elasticsearch

可以看到elasticsearch可使用的最小和最大内存都是2G

官方文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html

修改启动脚本

vim /usr/lib/systemd/system/elasticsearch.service
# 最下面添加
LimitMEMLOCK=infinity systemctl daemon-reload
systemctl restart elasticsearch

修改elastic配置文件锁定内存,这样在后期数据量比较大的时候,运行速度会比较快

vim /etc/elasticsearch/elasticsearch.yml

bootstrap.memory_lock: true

更改jvm.options 根据自己电脑的配置增加运行内存  最大32G

vim /etc/elasticsearch/jvm.options

# add code

-Xms3g
-Xmx3g

获取节点状态值

curl -sXGET http://192.168.56.12:9200/_cluster/health?pretty=true

使用脚本获取节点状态值  然后可以和zabbix结合报警

import json
import subprocess
false = "false"
obj = subprocess.Popen(("curl -sXGET http://192.168.56.12:9200/_cluster/health?pretty=true"),shell=True,st
dout=subprocess.PIPE)
data = obj.stdout.read()
data1 = json.loads(data)
status=data1.get("status")
if status == "green":
print("")
else:
print("")

ElasticSearch及其插件安装配置的更多相关文章

  1. ELK 学习笔记之 elasticsearch head插件安装

    elasticsearch head插件安装: 准备工作: 安装nodejs和npm https://nodejs.org/en/download/ node-v6.11.2-linux-x64.ta ...

  2. Elasticsearch入门教程(一):Elasticsearch及插件安装

    原文:Elasticsearch入门教程(一):Elasticsearch及插件安装 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:h ...

  3. 谷歌浏览器 插件安装配置Momentum chrome

    总之一句话就是这个Momentum插件可以把你的谷歌弄的漂亮一些,来搞一波 下载地址 http://www.cnplugins.com/down/predownnew.aspx?id=33842 下载 ...

  4. ElasticSearch head 插件安装

    head 客户端可以很方便在上面创建索引,类型,文档,还有查询,使用它管理elasticsearch 提高效率. 在安装head 客户端之前必须安装node.js 环境,因为它是用node.js 编写 ...

  5. Elasticsearch 监控插件安装(elasticsearch-head与Kibana)

    摘要 安装Elasticsearch插件Head与Kibana 版本 elasticsearch版本: elasticsearch-2.3.4 elasticsearch-head版本: 2.x(支持 ...

  6. ElasticSearch集群安装配置

    1. 环境说明 Cent OS 7 jdk-8u121-linux-x64.tar.gz elasticsearch-5.2.1.zip 2. 系统环境配置 新建进程用户 修改File Descrip ...

  7. sbt 以及 IDEA sbt 插件安装配置教程(转)

    1. 在Windows中安装sbt 下载 官网: http://www.scala-sbt.org/ github: https://github.com/sbt/sbt/releases/downl ...

  8. Elasticsearch安装(四), elasticsearch head 插件安装和使用。

    安装方式如下: 一.安装Elasticsearch-Head 1.插件安装方式(推荐) #在Elasticsearch目录下 $/bin/plugin -install mobz/elasticsea ...

  9. ElasticSearch head插件安装与配置

    下载 下载地址:https://github.com/mobz/elasticsearch-head 安装 1. 下载到本地 git clone 2. 安装 grunt npm install -g ...

随机推荐

  1. 如何理解H264 编码

    H264 结构 https://blog.csdn.net/andywang201001/article/details/80274886 H264 源码  https://www.cnblogs.c ...

  2. 【转载】 Asp.Net安全之防止脚本入

    在ASP.NET开发过程中,安全性是必须要重中之重需要考虑的,其中一种情况是要防止用户输入恶意脚本入侵的情况,恶意脚本入侵指的是用户在提交内容中提交了包含特殊Javascript脚本程序等非法信息,如 ...

  3. js展开循环

    当要对一个大数组进行循环时,通常会通过局部变量缓存数组长度来提高性能,例: for(var i=0,len=arr.len;i<len;i++){} 光是缓存数组长度或使用倒序遍历来减少判断外, ...

  4. Bootstrap源码

    1.Bootstrap Bootstrap是美国Twitter公司的设计师Mark Otto和Jacob Thornton合作基于HTML.CSS.JavaScript 开发的简洁.直观.强悍的前端开 ...

  5. 记一次bypass某场景GD库及拓展分析

    0x00 前言 gou楼兰师傅发来个站说是过不了gd库,问我有啥办法没有,给了他之前海贼师傅说的jpg_payload脚本,但是绕不过,问他拿了站点,写了个jpg_payload批量的fuzz脚本,f ...

  6. mysql日期模糊查找的方法

    Mysql模糊查询有以下三种方法: 1.Convert转成日期时间型,在用Like查询.select * from table1 where convert(date,DATETIME) like ' ...

  7. Linux-开机启动程序

    尝试一下几种方法: 1.修改  /etc/rc.local文件. 在exit0 前添加启动命令 2.在/home/pi/.config/autostart/  下添加.desktop 在.config ...

  8. Vue框架之vuex的使用

    1.首先需要在你的项目目录下安装vuex 终端命令: 2.在全局组件中导入与声明vuex 3.创建store实例对象 let store = new Vuex.store({ state:{ }, m ...

  9. Flutter中的按钮组件介绍

    Flutter 里有很多的 Button 组件很多,常见的按钮组件有:RaisedButton.FlatButton.IconButton.OutlineButton.ButtonBar.Floati ...

  10. Python语言程序设计:Lab4

    Programming 1.Analysing a Text File Look at the file xian_info.txt which is like this: Xi'an China 8 ...