elasticsearch单机部署

安装部署elasticsearch
1.下载地址
下载地址:https://www.elastic.co/downloads/elasticsearch,我这里下载的是 elasticsearch-6.4.0.tar.gz


2.解压缩并创建数据目录
[root@localhost soft]# tar -xvf elasticsearch-6.4.0.tar.gz
[root@localhost soft]# mv elasticsearch-6.4.0 /opt/
[root@localhost soft]#cd /opt/elasticsearch-6.4.0
[root@localhost soft]#mkdir data

3.创建用户
因为启动es不能在root用户下启动,所以要事先创建非root用户
[root@localhost opt]# useradd esuser
[root@localhost opt]# chown -R esuser.esuser ./elasticsearch-6.4.0/


4.配置环境变量
[esuser@localhost ~]$ more .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

JAVA_HOME=/opt/jdk1.8.0_151
PATH=$JAVA_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
export PATH

5.修改配置
vi /opt/elasticsearch-6.4.0/config/elasticsearch.yml
A.开放network.host,如下:
network.host: 192.168.1.85

B.在后面添加如下两项
http.cors.enabled: true
http.cors.allow-origin: "*"

C.修改日志存放路径
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /opt/elasticsearch-6.4.0/data
path.logs:/opt/elasticsearch-6.4.0/logs


6.修改系统配置文件
A.修改limits.conf配置文件
vi /etc/security/limits.conf
root用户下添加如下2两项,然后退出使用crate用户登陆,使其生效
*        hard    nofile           65536
*        soft    nofile           65536


B.修改sysctl.conf文件
vi /etc/sysctl.conf
vm.max_map_count=262144


执行下面命令生效
sysctl -p



7.退出重新登录用户登录并启动
[root@localhost opt]# su - esuser
[esuser@localhost bin]$ cd /opt/elasticsearch-6.4.0/bin
[esuser@localhost bin]$./elasticsearch -d


8.测试我们的es是否好用
[esuser@localhost logs]$ curl http://192.168.1.85:9200/?pretty
{
  "name" : "UyIrNGO",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "YNvgGJC0QLeMsKt71e7tsw",
  "version" : {
    "number" : "6.4.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "595516e",
    "build_date" : "2018-08-17T23:18:47.308994Z",
    "build_snapshot" : false,
    "lucene_version" : "7.4.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
[esuser@localhost logs]$ 


9.外部浏览器调试es时需要修改的配置

10.然后在浏览器里输入如下地址
http://192.168.1.85:9200/
posted @   slnngk  阅读(147)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示