ES5.1安装

ES5.1安装

一、系统环境准备

1、安装jdk

rpm -ivh jdk-8u91-linux-x64.rpm

 

修改环境变量vi /etc/profile

JAVA_HOME=/usr/java/jdk1.8.0_91

JRE_HOME=/usr/java/jdk1.8.0_91/jre

PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export JAVA_HOME JRE_HOME PATH CLASSPATH

 

source /etc/profile

 

2、修改hosts

vi /etc/hosts

192.168.2.35 T-BJ-ES-01 T-BJ-ES-01

192.168.2.36 T-BJ-ES-02 T-BJ-ES-02

192.168.2.37 T-BJ-ES-03 T-BJ-ES-03

192.168.2.38 T-BJ-ES-04 T-BJ-ES-04

192.168.2.39 T-BJ-ES-05 T-BJ-ES-05

3、修改network

vi /etc/sysconfig/network

HOSTNAME=主机名

 

4、关闭selinux

vi /etc/selinux/config

SELINUX=disabled

重启机器

5、配置免密(可选)

ssh-keygen -t rsa

ssh-copy-id 主机名

 

  1. 文件数与虚拟内存配置

    vi /etc/sysctl.conf

    添加下面配置:

    fs.file-max=655350

    vm.max_map_count=655360

    并执行命令:

    sysctl -p

     

    vi /etc/security/limits.conf

    添加下面配置:

    * soft nofile 655350

    * hard nofile 655350

     

  2. 安装es

    1、下载

    https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz

    2、解压

    tar -zxvf elasticsearch-5.1.1.tar.gz

    3、新建存储目录

    mkdir /mnt/data/esdata

    chmod -R 777 /mnt/data/esdata/

     

    4、修改配置

    1)vi /usr/local/elasticsearch-5.1.1/config/elasticsearch.yml

    添加下面配置:(注意每台节点更改对应的name与host)

    http.cors.enabled: true

    http.cors.allow-origin: "*"

     

    thread_pool:

    bulk:

    size: 5

    queue_size: 1000

    cluster.name: es-bj

    node.name: node-1

     

    bootstrap.memory_lock: false

    network.host: 192.168.2.35

    indices.fielddata.cache.size: 25%

     

    path.data: /mnt/data/esdata

    http.port: 12200

    transport.tcp.port: 12300

    discovery.zen.ping_timeout: 20s

    discovery.zen.minimum_master_nodes: 3

    discovery.zen.ping.unicast.hosts: ["192.168.2.35", "192.168.2.36","192.168.2.37","192.168.2.38","192.168.2.39"]

    action.auto_create_index: true

    xpack.security.enabled: false

     

    2)vi /usr/local/elasticsearch-5.1.1/config/jvm.options

    更改下面配置:

    -Xms6g

    -Xmx6g

  3. 安装kibana

    1、下载地址

    https://artifacts.elastic.co/downloads/kibana/kibana-5.1.1-linux-x86_64.tar.gz

     

    2、解压

    tar -zxvf kibana-5.1.1-linux-x86_64.tar.gz

    3、更改配置

    vi kibana-5.1.1-linux-x86_64/config/kibana.yml

    添加下面配置:

    server.port: 5500

    server.host: "192.168.2.37"

    elasticsearch.url: "http://192.168.2.37:12200"

    elasticsearch.requestTimeout: 180000

    elasticsearch.pingTimeout: 15000

    xpack.security.enabled: false

  4. 安装x-pack

    /usr/local/elasticsearch-5.1.1/bin/elasticsearch-plugin install x-pack

    /usr/local/kibana-5.1.1-linux-x86_64/bin/kibana-plugin install file:///root/x-pack-5.1.1.zip

     

  5. 安装head

    1、下载安装head插件

    wget https://codeload.github.com/mobz/elasticsearch-head/zip/master

    mv master master.zip

    unzip master.zip

     

    2、下载安装nodejs

    wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz

    xz -d node-v6.9.2-linux-x64.tar.xz

    tar -xvf node-v6.9.2-linux-x64.tar

    mv node-v6.9.2-linux-x64 /usr/local/node

     

    3、配置node环境变量

    vim /etc/profile

    export NODE_HOME=/usr/local/node

    export PATH=$PATH:$NODE_HOME/bin

    source /etc/profile

     

    验证

    # node –v

    v6.9.2

    # npm –v

    3.10.9

     

    4、安装grunt

    cd elasticsearch-head-master

    npm install grunt

     

    5、测试grunt

    cd elasticsearch-head-master

    node_modules/grunt/bin/grunt

     

    出现以下提示,为Gruntfile.js引用的,缺少以下包

     

    >> 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.

    Aborted due to warnings.

     

    需安装:

    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

     

    6、修改head目录下的Gruntfile.js配置,head默认监听127.0.0.1

    vi Gruntfile.js

    options: {

    hostname: '0.0.0.0',

    添加hostname: '0.0.0.0',

     

    修改连接地址:目录:head/_site/app.js

    修改head的连接地址:

    this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";

    把localhost修改成你es的服务器地址,如:

    this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.10.10:9200";

     

    7、运行

    node_modules/grunt/bin/grunt server

    后台运行:nohup node_modules/grunt/bin/grunt server &

     

    8 、访问

    http://localhost:9100

  6. 修改权限

    因需在t用户下运行elastic,需更改root安装文件的权限:

    chmod -R 777 /usr/local/elasticsearch-5.1.1

     

    并确保t具有es数据目录的读写权限。

     

     

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值