Elasticsearch 安装

 
 
1,Elasticsearch 安装:
    官网下载 https://www.elastic.co/downloads/past-releases/elasticsearch-5-2-2 安装包
    解压 Elasticsearch安装包
     tar -zxvf elasticsearch-5.6.2.tar.gz
    
    elasticsearch安装目录下创建二个目录
    
     
    配置 elasticsearch.yml (目前是单个机器,所以下面discovery只写了一个linux01 ,否则增加host 用逗号隔开)
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: kevin-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/kevin/modules/elasticsearch-5.6.2/data
#
# Path to log files:
#
path.logs: /home/kevin/modules/elasticsearch-5.6.2/logs
#
# ----------------------------------- Memory -----------------------------------
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.20
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["linux01"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
 
 
 
配置linux系统环境
    (参考:http://blog.csdn.net/satiling/article/details/59697916
       (1)切换到root用户,编辑limits.conf 添加类似如下内容
[root@hadoop102 elasticsearch-5.2.2]# vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
       (2)切换到root用户,进入limits.d目录下修改配置文件。
[root@hadoop102 elasticsearch-5.2.2]# vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
       (3)切换到root用户修改配置sysctl.conf
[root@hadoop102 elasticsearch-5.2.2]# vi /etc/sysctl.conf 
添加下面配置:
vm.max_map_count=655360
并执行命令:
[root@hadoop102 elasticsearch-5.2.2]# sysctl -p
 
切换成普通用户启动elasticsearch
bin/elasticsearch
 
网页查看 linux01:9200   如果显示下面这个表示 成功
 
2 .ElasticSearh head插件安装:(其实就是一个显示的界面)
1)下载插件
https://github.com/mobz/elasticsearch-head
elasticsearch-head-master.zip
2)nodejs官网下载安装包
https://nodejs.org/dist/
3), 解压 tar -zxf node-v6.9.2-linux-x86.tar.gz -C ~/modules/
     解压unzip elasticsearch-head-master.zip -d ~/modules/
    
4),配置nodejs 的环境变量
        vim  /etc/profile  增加下面的内容
    
 
5),用root用户 source /etc/profile
        执行node -v  
 
        如果报错: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
Protected multilib versions: libstdc++-4.4.7-23.el6.i686 != libstdc++-4.4.7-18.el6.x86_64
 
        参考:
                      yum update libstdc++-4.4.7-18.el6.x86_64
                     yum install libstdc++-4.4.7-23.el6.i686
 
 
    6),解压head 插件到~/module/
        查看插件目录下 有无node_module/grunt 目录    如果没有  npm install grunt -save 
    
 
      安装head 插件: npm install -g cnpm --registry=https://registry.npm.taobao.org
 
 
安装grunt 客户端 npm install -g grunt-cli
 
 
编辑Gruntfile.js   添加hostname:'0.0.0.0'
 
 检查head根目录下是否存在base文件夹
    没有:将 _site下的base文件夹及其内容复制到head根目录下
 
把权限全部给kevin 用户
 
切换用户到kevin  然后执行 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
最后一个模块可能安装不成功,但是不影响使用。
 
 
启动:grunt server 
 
 
 
看到显示“”集群健康值: 未连接“”
 
进入elasticSearch安装目录 vim config/elasticsearch.yml   在最后添加
 
http.cors.enabled: true
http.cors.allow-origin: "*"
再重新启动elasticsearch     bin/elasticsearch
再重新启动插件 进入插件目录 grunt server
然后浏览器 查看
 
 
 
 
 
 
posted on 2018-11-27 11:32  一只猪儿虫  阅读(197)  评论(0编辑  收藏  举报