初识Elasticsearch之安装部署......(二)

一、安装包下载
Elasticsearch官网: https://www.elastic.co/products/elasticsearch
二、安装Elasticsearch(单节点Linux环境)

  1. 解压elasticsearch-5.6.1.tar.gz到/install/目录下
[hadoop@hadoop02 tools]$ tar -xvf elasticsearch-5.6.1.tar.gz -C ../install/
  1. 在/install/elasticsearch-5.6.1.tar.gz/路径下创建data和logs文件夹
[hadoop@hadoop02 elasticsearch-5.6.1]$  mkdir data
[hadoop@hadoop02 elasticsearch-5.6.1]$ mkdir logs
  1. 修改配置文件/install/elasticsearch-5.6.1.tar.gz/config/elasticsearch.yml
[hadoop@hadoop02 config]$ vi elasticsearch.yml 
# ---------------------------------- Cluster -----------------------------------
cluster.name: my-application
# ------------------------------------ Node ------------------------------------
node.name: node-1
# ----------------------------------- Paths ------------------------------------
path.data:/home/hadoop/install/elasticsearch-5.6.1/data/
path.logs:/home/hadoop/install/elasticsearch-5.6.1/logs/
# ----------------------------------- Memory -----------------------------------
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
# ---------------------------------- Network -----------------------------------
network.host: 192.168.22.133 
# --------------------------------- Discovery ----------------------------------
discovery.zen.ping.unicast.hosts: ["hadoop02"]

(1)cluster.name
如果要配置集群需要两个节点上的elasticsearch配置的cluster.name相同,都启动可以自动组成集群,这里如果不改cluster.name则默认是cluster.name=my-application,
(2)nodename随意取但是集群内的各节点不能相同
(3)修改后的每行前面不能有空格,修改后的“:”后面必须有一个空格
4.配置linux系统环境
(1)切换到root用户,编辑limits.conf 添加类似如下内容

[root@hadoop02 elasticsearch-5.6.1]# vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

(2)切换到root用户,进入limits.d目录下修改配置文件。

[root@hadoop02 elasticsearch-5.6.1]# vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048

(3)切换到root用户修改配置sysctl.conf

[root@hadoop02 elasticsearch-5.6.1]# vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360

并执行命令:可以使配置生效

[root@hadoop02 elasticsearch-5.6.1]# sysctl -p

然后,重新启动elasticsearch,即可启动成功。
(4)启动集群!!!注意切换用户

[hadoop@hadoop02 elasticsearch-5.6.1]$bin/elasticsearch 

(5)测试集群

[hadoop@hadoop02 elasticsearch-5.6.1]$curl http://hadoop02:9200
{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "v-nwhc7ITsmVHECpNQYzHw",
  "version" : {
    "number" : "5.6.1",
    "build_hash" : "57e20f3",
    "build_date" : "2018-09-23T13:16:45.703Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.1"
  },
  "tagline" : "You Know, for Search"
}

(6)停止集群
kill -9 进程号
三、安装Elasticsearch(多节点集群Linux环境)
多节点同上操作即可,有些地方修改。
四、Elasticsearch head插件安装
(1)下载插件
https://github.com/mobz/elasticsearch-head
elasticsearch-head-master.zip
(2)nodejs官网下载安装包
https://nodejs.org/dist/
node-v6.9.2-linux-x64.tar.xz
(3)将elasticsearch-head-master.zip和node-v6.9.2-linux-x64.tar.xz都导入到linux的/install目录。
(4)安装nodejs

[hadoop@hadoop02 tools]$  tar -zxvf node-v6.9.2-linux-x64.tar.gz -C ../install

(5) 配置nodejs环境变量

[root@hadoop02 install]# vi /etc/profile
export NODE_HOME=/home/hadoop/install/node-v6.9.2-linux-x64
export PATH=$PATH:$NODE_HOME/bin
[root@hadoop02 install]# source /etc/profile 

(6) 查看node和npm版本

[root@hadoop02 install]# node -v
v6.9.2 
[root@hadoop02 install]# npm -v
3.10.9 

(7)解压head插件到/insatll目录下

[hadoop@hadoop02 tools]$ unzip elasticsearch-head-master.zip -d ../insatll/

(8) 查看当前head插件目录下有无node_modules/grunt目录:
没有:执行命令创建:

[hadoop@hadoop02 elasticsearch-head-master]$  npm install grunt --save

(9)安装head插件:

[hadoop@hadoop02 elasticsearch-head-master]$ npm install -g cnpm --registry=https://registry.npm.taobao.org

(10)安装grunt:

[hadoop@hadoop02 elasticsearch-head-master]$ npm install -g grunt-cli

(11)编辑Gruntfile.js

[hadoop@hadoop02 elasticsearch-head-master]$ vim Gruntfile.js
#文件93行添加hostname:'0.0.0.0'
options: {
        hostname:'0.0.0.0',
        port: 9100,
        base: '.',
        keepalive: true
      }

(12)检查head根目录下是否存在base文件夹
没有:将 _site下的base文件夹及其内容复制到head根目录下

[hadoop@hadoop02 elasticsearch-head-master]$ mkdir base
[hadoop@hadoop02  _site]$  cp base/* ../base/

(13)启动grunt server:

[hadoop@hadoop02 elasticsearch-head-master]$  grunt server -d
如果提示grunt的模块没有安装:
Local Npm module “grunt-contrib-clean” not found. Is it installed? 
Local Npm module “grunt-contrib-concat” not found. Is it installed? 
Local Npm module “grunt-contrib-watch” not found. Is it installed? 
Local Npm module “grunt-contrib-connect” not found. Is it installed? 
Local Npm module “grunt-contrib-copy” not found. Is it installed? 
Local Npm module “grunt-contrib-jasmine” not found. Is it installed? 
Warning: Task “connect:server” not found. Use –force to continue. 
执行以下命令: 
npm install grunt-contrib-clean -registry=https://registry.npm.taobao.org
npm install grunt-contrib-concat -registry=https://registry.npm.taobao.org
npm install grunt-contrib-watch -registry=https://registry.npm.taobao.org 
npm install grunt-contrib-connect -registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy -registry=https://registry.npm.taobao.org 
npm install grunt-contrib-jasmine -registry=https://registry.npm.taobao.org
最后一个模块可能安装不成功,但是不影响使用。

(14)浏览器访问head插件

http://hadoop102:9100

(15)启动集群插件后发现集群未连接

[hadoop@hadoop02 config]$ pwd
/home/hadoop/install/elasticsearch-5.6.1/config
[hadoop@hadoop02 config]$ vi elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"

再重新启动elasticsearch。
切记需要输入你自己的IP,点击连接,别傻傻的刷新界面!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
校园悬赏任务平台对字典管理、论坛管理、任务资讯任务资讯公告管理、接取用户管理、任务管理、任务咨询管理、任务收藏管理、任务评价管理、任务订单管理、发布用户管理、管理员管理等进行集中化处理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择小程序模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行校园悬赏任务平台程序的开发,在数据库的选择上面,选择功能强大的Mysql数据库进行数据的存放操作。校园悬赏任务平台的开发让用户查看任务信息变得容易,让管理员高效管理任务信息。 校园悬赏任务平台具有管理员角色,用户角色,这几个操作权限。 校园悬赏任务平台针对管理员设置的功能有:添加并管理各种类型信息,管理用户账户信息,管理任务信息,管理任务资讯公告信息等内容。 校园悬赏任务平台针对用户设置的功能有:查看并修改个人信息,查看任务信息,查看任务资讯公告信息等内容。 系统登录功能是程序必不可少的功能,在登录页面必填的数据有两项,一项就是账号,另一项数据就是密码,当管理员正确填写并提交这者数据之后,管理员就可以进入系统后台功能操作区。项目管理页面提供的功能操作有:查看任务,删除任务操作,新增任务操作,修改任务操作。任务资讯公告信息管理页面提供的功能操作有:新增任务资讯公告,修改任务资讯公告,删除任务资讯公告操作。任务资讯公告类型管理页面显示所有任务资讯公告类型,在此页面既可以让管理员添加新的任务资讯公告信息类型,也能对已有的任务资讯公告类型信息执行编辑更新,失效的任务资讯公告类型信息也能让管理员快速删除。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值