当前位置: 首页 > news >正文

centos7 安装 elasticsearch-6.2.4

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

java环境安装

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

选择linux-x64

tar zxvf jdk-8u171-linux-x64.tar.gz
mv jdk1.8.0_171 /usr/local/jdk1.8

配置环境变量

vim /etc/profile

export PATH=/usr/local/jdk1.8/bin:$PATH
export JAVA_HOME=/usr/local/jdk1.8
export CLASSPATH=.:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib   

启用配置

source /etc/profile    

 

安装elasticsearch
---------------------------------------------------

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

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.zip
unzip elasticsearch-6.2.4.zip
mv elasticsearch-6.2.4 /usr/local/elasticsearch-6.2.4

5.0.0版本后禁止用root账号启动,所以测试时要换成非root账号

> bin/elasticsearch

测试下

curl http://127.0.0.1:9200

 

systemd服务配置
---------------------------------------------------
创建服务账号
useradd -M -s /sbin/nologin elasticsearch

提取官网的rpm安装包中配置文件并上传服务器
elasticsearch-6.2.4-1.noarch/usr/lib/systemd/system/elasticsearch.service
elasticsearch-6.2.4-1.noarch/etc/sysconfig/elasticsearch

修改 /etc/sysconfig/elasticsearch

################################
# Elasticsearch
################################

# Elasticsearch home directory
#ES_HOME=/usr/share/elasticsearch

# Elasticsearch Java path
JAVA_HOME=/usr/local/jdk1.8
CLASSPATH=.:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib

# Elasticsearch configuration directory
ES_PATH_CONF=/usr/local/elasticsearch-6.2.4/config

# Elasticsearch PID directory
#PID_DIR=/var/run/elasticsearch

# Additional Java OPTS
#ES_JAVA_OPTS=

# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true

################################
# Elasticsearch service
################################

# SysV init.d
#
# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
ES_STARTUP_SLEEP_TIME=5

################################
# System properties
################################

# Specifies the maximum file descriptor number that can be opened by this process
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
# /usr/lib/systemd/system/elasticsearch.service takes precedence
#MAX_OPEN_FILES=65536

# The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml.
# When using systemd, LimitMEMLOCK must be set in a unit file such as
# /etc/systemd/system/elasticsearch.service.d/override.conf.
#MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
#MAX_MAP_COUNT=262144

修改 /usr/lib/systemd/system/elasticsearch.service


[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target

[Service]
#RuntimeDirectory=elasticsearch
Environment=ES_HOME=/usr/local/elasticsearch-6.2.4
Environment=ES_PATH_CONF=/usr/local/elasticsearch-6.2.4/config
Environment=PID_DIR=/var/run/elasticsearch
EnvironmentFile=/etc/sysconfig/elasticsearch

WorkingDirectory=/usr/local/elasticsearch-6.2.4

User=elasticsearch
Group=elasticsearch

ExecStart=/usr/local/elasticsearch-6.2.4/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid 

# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Specifies the maximum number of processes
LimitNPROC=4096

# Specifies the maximum size of virtual memory
LimitAS=infinity

# Specifies the maximum file size
LimitFSIZE=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
 
# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Send the signal only to the JVM rather than its control group
KillMode=process

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

# Built for distribution-6.2.4 (distribution)

添加到systemd

systemctl daemon-reload
systemctl enable  elasticsearch.service
systemctl start  elasticsearch.service

查看启动状态

systemctl status  elasticsearch.service
ps aux | grep java 

如果出错了查看日志

journalctl -u  elasticsearch.service

 

其他

---------------------------------------------------------------

安装中文分词插件 elasticsearch-analysis-ik

cd /usr/local/elasticsearch-6.2.4/plugins

wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.4/elasticsearch-analysis-ik-6.2.4.zip

unzip elasticsearch-analysis-ik-6.2.4.zip

systemctl restart elasticsearch.service

#查看插件是否安装上
./elasticsearch-plugin list

 

---------------------------------------------------------------

安装kibana   Dev Tools工具方便测试 curl命令写的麻烦

下载地址 https://www.elastic.co/cn/downloads/kibana

wget https://artifacts.elastic.co/downloads/kibana/kibana-6.2.4-linux-x86_64.tar.gz
tar xzvf kibana-6.2.4-linux-x86_64.tar.gz
cd kibana-6.2.4-linux-x86_64/bin

#启动
./kibana

外网访问需要修改kibana绑定ip,默认是绑定localhost

vim config/kibana.yml

#修改为ip地址如 (写成0.0.0.0没用)
server.host:  192.168.1.11

浏览器访问 http://192.168.1.11:5601

如果有防火墙或者不对外开放,可以用ssh代理。参见文章

 

---------------------------------------------------------------

安装mysql同步工具 go-mysql-elasticsearch

转载于:https://my.oschina.net/jszhang/blog/1799862

相关文章:

  • Kubernetes 1.10和Cross-Cloud CI Project Dashboard 1.3释放,Kubernetes发布用户调查
  • 【大数据】数据的优美
  • JAVA——泛型类和泛型方法(静态方法泛型)
  • oracle修改某个表的字段顺序
  • 令牌桶算法限流
  • nginx的ngx_module_s 模块
  • 阿里云RDS-MYSQL数据库参数设置
  • k8s实验环境的快速搭建
  • IBM欲寻找量子杀手级应用
  • jQuery插件 -- Form表单插件jquery.form.js
  • 日志框架 - 基于spring-boot - 实现2 - 消息定义及消息日志打印
  • php命令行生成项目结构
  • P4035 [JSOI2008]球形空间产生器
  • 简述this指向
  • 如何理解angular自定义指令directive的scope属性?
  • 8年软件测试工程师感悟——写给还在迷茫中的朋友
  • CentOS7 安装JDK
  • oldjun 检测网站的经验
  • Sequelize 中文文档 v4 - Getting started - 入门
  • TiDB 源码阅读系列文章(十)Chunk 和执行框架简介
  • Yii源码解读-服务定位器(Service Locator)
  • 纯 javascript 半自动式下滑一定高度,导航栏固定
  • 从0到1:PostCSS 插件开发最佳实践
  • 检测对象或数组
  • 前端存储 - localStorage
  • 学习笔记:对象,原型和继承(1)
  • MPAndroidChart 教程:Y轴 YAxis
  • ​草莓熊python turtle绘图代码(玫瑰花版)附源代码
  • #etcd#安装时出错
  • (1)(1.11) SiK Radio v2(一)
  • (13)Latex:基于ΤΕΧ的自动排版系统——写论文必备
  • (八)光盘的挂载与解挂、挂载CentOS镜像、rpm安装软件详细学习笔记
  • (板子)A* astar算法,AcWing第k短路+八数码 带注释
  • (办公)springboot配置aop处理请求.
  • (二)基于wpr_simulation 的Ros机器人运动控制,gazebo仿真
  • (三十五)大数据实战——Superset可视化平台搭建
  • (转)利用ant在Mac 下自动化打包签名Android程序
  • (最优化理论与方法)第二章最优化所需基础知识-第三节:重要凸集举例
  • .bat批处理(十):从路径字符串中截取盘符、文件名、后缀名等信息
  • .NET : 在VS2008中计算代码度量值
  • .NET CORE Aws S3 使用
  • .NET delegate 委托 、 Event 事件,接口回调
  • .NET 除了用 Task 之外,如何自己写一个可以 await 的对象?
  • .net 写了一个支持重试、熔断和超时策略的 HttpClient 实例池
  • @EnableConfigurationProperties注解使用
  • @synthesize和@dynamic分别有什么作用?
  • @Tag和@Operation标签失效问题。SpringDoc 2.2.0(OpenApi 3)和Spring Boot 3.1.1集成
  • [ 渗透测试面试篇 ] 渗透测试面试题大集合(详解)(十)RCE (远程代码/命令执行漏洞)相关面试题
  • [BZOJ4566][HAOI2016]找相同字符(SAM)
  • [C#]C# winform部署yolov8目标检测的openvino模型
  • [cocos2d-x]关于CC_CALLBACK
  • [FFmpeg学习]从视频中获取图片
  • [Geek Challenge 2023] web题解
  • [hive] 窗口函数 ROW_NUMBER()
  • [iOS]Win8下iTunes无法连接iPhone版本的解决方法