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. MM-发票校验与收货的差异处理

    SAP FI-财务发票校验修改金额后没有进入差异科目问题:公司新建物料采购订单,在MM科目自动确定配置完成后,做发票校验时,修改金额没修改数量时,差异进入了原材料科目 换采购订单继续测试时,修改金额没 ...

  2. cell上的按钮点击和左滑冲突

    cell上的某个按钮的点击事件,当cell左滑的时候,只要活动的区域也在按钮上,那么按钮的点击事件也会调用. fix: 给按钮添加一个手势(TapGesture)那么当点击的时候就会响应点击手势的方法 ...

  3. centos iptables 数据转发

    iptables -t nat -I PREROUTING -p tcp --dport 3389 -j DNAT --to 38.X25.X.X02 iptables -t nat -I POSTR ...

  4. Android笔记(二十二) Android中的GridView

    GridView和ListView一样,是Android中比较常见的布局控件,譬如我们的手机桌面其实就是一个GridView. 效果: 实现过程和ListView类似,也是通过Adapter将数据源展 ...

  5. Windows Server 2008上网设置——IE

    IE安装设置 在 Windows Sever 2008 中打开 IE 浏览器时,IE 会出现[已启用 Internet Explorer 增强的安全配置]的提示信息. Windows Server 2 ...

  6. Python使用jieba分词

    # -*- coding: utf-8 -*- # Spyder (python 3.7) import pandas as pd import jieba import jieba.analyse ...

  7. Usages for IntelliJ & Eclipse

    IntelliJ ⌘E Select a recently opened file from the list. ⌘/ (left command + /)⌥⌘/ (right command + / ...

  8. 在Linux命令行中操作PDF

    pdftk 命令提供了许多处理 PDF 的命令行操作,包括合并页面.加密文件.添加水印.压缩文件,甚至还有修复 PDF. 虽然 PDF 通常被认为是相当稳定的文件,但在 Linux 和其他系统上你可以 ...

  9. SQL Server 2005的几个新功能

    SQL Server 2005相对于SQL Server 2000改进很大,有些还是非常实用的. 举几个例子来简单说明 这些例子我引用了Northwind库. 1. TOP 表达式  SQL Serv ...

  10. linux网络编程之socket编程(十)

    今天继续socket编程的学习,最近晚上睡觉都没有发热,没有暖气的日子还是种煎熬,快乐的十一也已经走来,幸福有暖气的日子也快啦,好了,回到正题~ ①close终止了数据传送的两个方向. ②shutdo ...