首页 > 其他 > 详细

ES(elasticsearch)安装使用

时间:2019-04-24 16:57:26      阅读:174      评论:0      收藏:0      [点我收藏+]

首先配置系统参数(各个节点均需要配置)

1. 设置内核参数
vim /etc/sysctl.conf
添加如下内容:
fs.file-max=65536
vm.max_map_count=262144
之后可以使用sysctl –a查看 –p刷新
2. 设置资源参数
vim /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
3. 修改进程数 (7.x是修改20-nproc.conf文件)
vim /etc/security/limits.d/90-nproc.conf
修改( * soft nproc )的值为2048

  

1、下载es:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.15.tar.gz

解压配置vim /opt/es-5.6/config/elasticsearch.yml(分发各个节点,ip和name不同)

cluster.name: my-es # 集群名字,如果有2个以上集群,名字需要唯一
node.name: node1 # 节点名 
network.host: 192.168.88.131
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.88.131", "192.168.88.132", "192.168.88.133"]
# 如果要使用head,那么需要增加新的参数,使head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"
#centos 6.5 版本中,启动时报错:system call filters failed to install;
#check the logs and fix your configuration or disable system call filters at your own risk
#添加该配置项
bootstrap.system_call_filter: false

  启动不能用root

#使用root用户创建es普通用户
useradd  es	
#设置elasticsearch文件夹的归属
chown -R es  /usr/local/elasticsearch	
#切换为es用户
su es	
#切换目录到es的bin目录下
cd /usr/local/elasticsearch/bin	
#当前窗口启动es服务 或者加 -d 参数后台启动
./elasticsearch

  curl http://node1:9200/?pretty 测试一下,然后分发,不同节点的node.name和network.host不同,然后各个节点启动即可

  curl http://node1:9200/_cluster/health?pretty

{
  "cluster_name" : "my-es",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

  

2、node安装

     下载解压 http://nodejs.cn/download/  tar -zxvf  node-10.15

export NODE_HOME=/opt/node-10.15
export NODE_PATH=$NODE_HOME/lib/node_modules
export PATH=$PATH:$NODE_HOME/bin

  记得source生效一下

node -v            npm -v              看一下版本

3、grunt安装

下载地址https://gruntjs.com/

 

ES(elasticsearch)安装使用

原文:https://www.cnblogs.com/wangyf01/p/10763287.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!