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. robot framework 怎么验证搜索无记录,页面元素不存在

    假设你要验证搜索无记录,页面元素不存在,假设我搜索的文本为你好 页面展示为如下 搜索:你好 假设页面搜索有结果: 你好  class=vtext 你好1  class=vtext 你好2  class ...

  2. Devices Tree加载流程

    DT.IMG布局 hdr zImage Ramdisk.img DT.img 其中DT.img由DTBTOOL打包所有编译生成的dtb生成:布局如下: DT header dt_entry_0 dt_ ...

  3. git 添加码云远程仓库和上传到码云的命令

     添加远程仓库 git remote add Zk  仓库地址.git 查看远程仓库 git remote -v 上传远程仓库 git push Zk master 删除远程仓库Zkgit remot ...

  4. Go数据类型之基本数据类型

    不想沦为芸芸众生的人只需做一件事,便是对自己不再散漫:他应当听从良知的呼唤:“成为你自己!” ---尼采 1.整型 有符号整数类型:int8.int16.int32和int64 无符号整数类型:uin ...

  5. C++——多态实现原理分析

    前言 虚函数执行速度要稍慢一些.为了实现多态性,每一个派生类中均要保存相应虚函数的入口地址表,函数的调用机制也是间接实现.所以多态性总是要付出一定代价,但通用性是一个更高的目标. 实验环境 Windo ...

  6. nginx日志配置笔记:if条件

    1.特定条件写日志: 参照: https://stackoverflow.com/questions/19011719/how-to-write-only-logs-with-200-status h ...

  7. 爬虫:selenium请求库

    一.介绍 二.安装 三.基本使用 四.选择器 五.等待元素被加载 六.元素交互操作 七.其他 八.项目练习 一.介绍 # selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requ ...

  8. Linux 中常见的填空题

    一.填空题: 1. 在Linux系统中,以文件方式访问设备 . 2. Linux内核引导时,从文件/etc/fstab中读取要加载的文件系统. 3. Linux文件系统中每个文件用i节点来标识. 4. ...

  9. 分享一个自制的USB转HART模块

    HART协议是一种用于现场智能仪表和控制室设备之间的通讯协议.使用USB转HART模块可以很方便的对HART总线上的数据进行监控,并且可以远程控制.操作和校准HART设备.设计的模块主要采用的是USB ...

  10. MySQL进阶12-- 数据类型介绍: 数值型/字符型/日期型-- 正负溢出保护/枚举型/set型/时间戳

    /*进阶12 SQL 数据类型介绍 数值型: 整数: Tinyint(1b) < mediumint(3b)<smallint(2b) <int(4b) <bigint(8b) ...