CentOS 7 搭建 ElasticSearch7.3.2(单点部署)

ElasticSearch官网
国内镜像下载
环境
  • IP: 192.168.1.46
  • 系统: CentOS 7.6
HostNameIPDES
test1192.168.1.46主控机
test2192.168.1.47node-1
test3192.168.1.48node-2
test4192.168.1.18node-3
修改hosts
[root@test1 ~]# cat >> /etc/hosts << eric
192.168.180.47  node-1
eric

[root@test1 ~]#
1. 创建用户
[root@test1 ~]# useradd -m -d /home/elasticsearch elasticsearch
[root@test1 ~]# passwd elasticsearch
输入密码
passwd:所有的身份验证令牌已经成功更新。
[root@test1 ~]#
[root@test1 ~]# visudo
elasticsearch ALL=(ALL) NOPASSWD: ALL
[root@test1 ~]#
[root@test1 ~]# su - elasticsearch
[elasticsearch@test1 ~]$
2. 下载/解压
[elasticsearch@test1 deploy]$ pwd
/home/elasticsearch/deploy
[elasticsearch@test1 deploy]$
[elasticsearch@test1 ~]$ curl -L -O https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
[elasticsearch@test1 deploy]$
[elasticsearch@test1 deploy]$ tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz

tar zxvf test.tgz -C 指定目录

3. [安装JDK]
4. 替换配置文件中如下部分属性

注意: 不修改配置,是不可以外网访问的,如下属性都是必须要配置的

[elasticsearch@test1 deploy]$ vim elasticsearch-7.3.2/config/elasticsearch.yml
#node.name: node-1
node.name: node-1

#network.host: 192.168.0.1
network.host: node-1

#http.port: 9200
http.port: 9200

# 允许跨域访问
http.cors.enabled: true
http.cors.allow-origin: "*"

path.data: /home/elasticsearch/deploy/elasticsearch-7.3.2/data
path.logs: /home/elasticsearch/deploy/elasticsearch-7.3.2/logs

# 快照路径
path.repo: /home/elasticsearch/deploy/elasticsearch-7.3.2/snapshots

cluster.initial_master_nodes: ['node-1']

##优化参数
indices.memory.index_buffer_size: 20%
indices.query.bool.max_clause_count: 100000000


5. 后台 启动 ElasticSearch
[elasticsearch@test1 ~]$ ./deploy/elasticsearch-7.3.2/bin/elasticsearch -d
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[elasticsearch@test1 ~]$
6. 查看启动是否成功
[elasticsearch@test1 ~]$  curl localhost:9200
{
  "name" : "node-1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "GwWYck6bRTyyMgXFxZW9Ew",
  "version" : {
    "number" : "7.3.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "22e1767283e61a198cb4db791ea66e3f11ab9910",
    "build_date" : "2019-09-27T08:36:48.569419Z",
    "build_snapshot" : false,
    "lucene_version" : "8.2.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
[elasticsearch@test1 ~]$
7、杀死es进程
ps -ef | grep elastic

kill -9 进程id

常见问题
1 bootstrap checks failed
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

原因:虚拟机限制用户的执行内存
解决问题[1][3]:在文件末尾追加配置

[elasticsearch@test1 deploy]$ sudo vim /etc/security/limits.conf

# BEGIN ES
*        soft     nofile         65536
*        hard     nofile         65536
*        soft     nproc          2048
*        hard     nproc          4096
# END ES

[elasticsearch@test1 deploy]$
# 需要重新连接用户

解决问题[2]:在文件末尾追加配置

[elasticsearch@test1 deploy]$ sudo vim /etc/sysctl.conf
......
vm.max_map_count = 262144

[elasticsearch@test1 deploy]$ sysctl -p
# 需要重新连接用户



[ElasticSearch 安装插件]
[部署 ElasticSearch 集群]
[安装 elasticsearch-head]
[安装 kibana]



相关资料

ES图解

ES数据存储

ES这个说的很明白

ES数据存储

ES官方 JavaAPI

Elasticsearch7.X为什么移除类型(Type)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值