elasticsearch-6.6.0 安装部署


elasticsearch-6.6.0 部署、

环境要求

系统版本 ip地址规划     软件包版本
CentOS Linux release 7.2.1511 (Core)  192.168.192.100

elasticsearch-6.6.0 

CentOS Linux release 7.2.1511 (Core)  192.168.192.101

elasticsearch-6.6.0 

CentOS Linux release 7.2.1511 (Core)  192.168.192.102

elasticsearch-6.6.0 

CentOS Linux release 7.2.1511 (Core)  192.168.192.112

 logstash-6.6.0.rpm  

CentOS Linux release 7.2.1511 (Core)  192.168.192.112

 logstash-6.6.0.rpm

安装es步骤  

系统参数调整   

内核参数调整

[root@elk1 ~]# sysctl  -p
vm.max_map_count = 655360
vm.swappiness = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 360
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000

文件打开句柄参数调整

[root@elk1 ~]# cat /etc/security/limits.conf 
* soft nproc 65536
* hard nproc 65536
* soft nofile 65536
* hard nofile 65536

elastic soft nofile 65536
elastic hard nofile 65536
elastic  -   memlock  unlimited
elastic  -   nproc     4096

下载 elasticesrach
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz

创建用户
useradd elastic

elasticsearch6.6.0默认内存需要1G,如果没有1G内存可能会报错,如果内存不够则需要修改配置文件

[root@elk1 config]# egrep -v '^#|^$' jvm.options 
-Xms20g           
-Xmx20g
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-Des.networkaddress.cache.ttl=60
-Des.networkaddress.cache.negative.ttl=10
-XX:+AlwaysPreTouch
-Xss1m
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djna.nosys=true
-XX:-OmitStackTraceInFastThrow
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-Djava.io.tmpdir=${ES_TMPDIR}
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/var/lib/elasticsearch
-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log
8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:/var/log/elasticsearch/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
9-:-Djava.locale.providers=COMPAT
10-:-XX:UseAVX=2

[root@elk1 config]# cat elasticsearch.yml 
cluster.name: es6
node.name: node-100
path.data: /opt/data/es
path.logs: /opt/logs/es
network.host: 192.168.192.100
http.port: 9200
transport.tcp.port: 9300
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.192.100:9300", "192.168.192.101:9300", "192.168.192.102:9300"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
gateway.recover_after_nodes: 2
gateway.recover_after_time: 5m
gateway.expected_nodes: 1
#script.engine.groovy.inline.search: on
#script.engine.groovy.inline.aggs: on
indices.recovery.max_bytes_per_sec: 20mbs 

 使用elastic普通用户启动服务

 su elastic                    切换elastic用户
cd /opt/elk/es/bin/    切换到es目录
./elasticsearch -d     手动启动 -d 后台运行

 部署安装 elasticsearch-head 插件

 安装nodejs 


curl -sL https://rpm.nodesource.com/setup_10.x | bash -
yum install gcc-c++ make&&sudo yum install -y nodejs  git 

 

克隆head插件


[root@elk1 ~]#git clone git://github.com/mobz/elasticsearch-head.git
[root@elk1 ~]#cd ~/elasticsearch-head
[root@elk1 elasticsearch-head]# npm install .

head 修改Gruntfile.js 

[root@elk1 elasticsearch-head]# cat Gruntfile.js 
module.exports = function(grunt) {
        var fileSets = require("./grunt_fileSets.js");
        // Project configuration.
        grunt.initConfig({
                clean: {
                        _site: {
                                src: ['_site']
                        }
                },
                concat: {
                        vendorjs: {
                                src: fileSets.vendorJs,
                                dest: '_site/vendor.js'
                        },
                        vendorcss: {
                                src: fileSets.vendorCss,
                                dest: '_site/vendor.css'
                        },
                        appjs: {
                                src: fileSets.srcJs,
                                dest: '_site/app.js'
                        },
                        appcss: {
                                src: fileSets.srcCss,
                                dest: '_site/app.css'
                        }
                },
                copy: {
                        site_index: {
                                src: 'index.html',
                                dest: '_site/index.html',
                                options: {
                                        process: function( src ) {
                                                return src.replace(/_site\//g, "");
                                        }
                                }
                        },
                        base: {
                                expand: true,
                                cwd: 'src/app/base/',
                                src: [ '*.gif', '*.png', '*.css' ],
                                dest: '_site/base/'
                        },
                        iconFonts: {
                                expand: true,
                                cwd: 'src/vendor/font-awesome/fonts/',
                                src: '**',
                                dest: '_site/fonts'
                        },
                        i18n: {
                                src: 'src/vendor/i18n/i18n.js',
                                dest: '_site/i18n.js'
                        },
                        lang: {
                                expand: true,
                                cwd: 'src/app/lang/',
                                src: '**',
                                dest: '_site/lang/'
                        }
                },
                jasmine: {
                        task: {
                                src: [ fileSets.vendorJs, 'src/vendor/i18n/i18n.js', 'src/app/lang/en_strings.js', fileSets.srcJs ],
                                options: {
                                        specs: 'src/app/**/*Spec.js',
                                        helpers: 'test/spec/*Helper.js',
                                        display: "short",
                                        summary: true
                                }
                        }
                },
                watch: {
                        "scripts": {
                                files: ['src/**/*', 'test/spec/*' ],
                                tasks: ['default'],
                                options: {
                                        spawn: false
                                }
                        },
                        "grunt": {
                                files: [ 'Gruntfile.js' ]
                        }
                },
                connect: {
                        server: {
                                options: {
                                        hostname: '0.0.0.0',
                                        port: 9100,
                                        base: '.',
                                        keepalive: true
                                }
                        }
                }
        });
        grunt.loadNpmTasks('grunt-contrib-clean');
        grunt.loadNpmTasks('grunt-contrib-concat');
        grunt.loadNpmTasks('grunt-contrib-watch');
        grunt.loadNpmTasks('grunt-contrib-connect');
        grunt.loadNpmTasks('grunt-contrib-copy');
        grunt.loadNpmTasks('grunt-contrib-jasmine');
        // Default task(s).
        grunt.registerTask('default', ['clean', 'concat', 'copy', 'jasmine']);
        grunt.registerTask('server', ['connect:server']);
        grunt.registerTask('dev', [ 'default', 'watch' ]);
};

  

在 connect添加

server: {
    options: {
    hostname: '0.0.0.0',
    port: 9100,
    base: '.',
}

  修改app.js默认地址 链接集群配置

 [root@elk1 _site]# pwd
 /root/elasticsearch-head/_site
[root@elk1 _site]# cat app.js |grep localhost 
                        this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
[root@elk1 _site]# cat app.js |grep localhost -n
4360:                   this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
[root@elk1 _site]# ` 
 /root/elasticsearch-head/_site/app.js里面localhost:9200修改成
[root@elk1 _site]# cat app.js |grep localhost -n
4360:                   this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.192.100:9200";
[root@elk1 _site]# 

  

启动head服务器

 npm run start &  后台运行

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM