elasticsearch5.* yum或者rpm部署 应该注意事项

1.yum 部署

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cd /etc/yum.repos.d/

vim elasticsearch.repo
[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

yum install elasticsearch -y

2.或者rpm部署的老司机(本质与方式一相同)

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.1.rpm
sha1sum elasticsearch-5.2.1.rpm 
rpm --install elasticsearch-5.2.1.rpm

3注意事项

3.1用户进程数扩大
#因为es集群中程序会启用大量线程,所以进程瓶颈不能太少了
sed -i 's#1024#2048#g' /etc/security/limits.d/90-nproc.conf
3.2设置进程能拥有的最多内存区域
#根据生产情况硬件调试
vim /etc/sysctl.conf
#插入参数
vm.max_map_count=262144

sysctl -p
3.3描述符调整
cat >> /etc/security/limits.conf <<EOF
*               soft    nofile          65536
*               hard    nofile          131072
*               soft    nproc           4096
*               hard    nproc           4096
elasticsearch   soft    memlock         unlimited
elasticsearch   hard    memlock         unlimited
EOF

4.es配置及注意项

#es安装后默认是没有配置的
vim /etc/elasticsearch/elasticsearch.yml

cluster.name: es-cluster01
node.name: es-node01
path.data: /data/es/data
path.logs: /data/es/logs
bootstrap.memory_lock: true   #可锁也可不锁
network.host: 11.0.0.51
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.system_call_filter: false   #centos6不支持项,需要false掉,不然es起不来,他会一直去检测bootstrap,然后报错

#这是在因为Centos6不支持SecComp,而ES5.2.*默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

#我们配置了目录,需要创建修改启动用户,不然启动不了es
mkdir /data/es/{data,log} -p
chown -R elasticsearch:elasticsearch /data/es
/etc/init.d/elasticsearch start

5.安装x-pack插件

#x-pack是连接elasticsearch的加密工具,可以配置账号密码
cd /usr/share/elasticsearch
./bin/elasticsearch-plugin install x-pack

#es依赖于java环境所以需要jdk

#修改x-pack密码:
curl -XPUT -u elastic '11.0.0.51:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456"}'
Enter host password for user 'elastic':
默认密码是changeme

#我们也可以在elasticsearch.xml配置文件中设置x-pack的验证用户,使我们可以直接连接elasticsearch-head,如果不设置超级用户,后面会连接不上elasticsearch-head

vim /etc/elasticsearch/elasticsearch.yml

    xpack.security.authc:
    anonymous:
        username: elastic
        roles: superuser
        authz_exception: true

6.安装analysis-ik插件

    cd /usr/local/src
    wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.2.1/elasticsearch-analysis-ik-5.2.1.zip

    mkdir /usr/share/elasticsearch/plugins/analysis-ik -p
    cp elasticsearch-analysis-ik-5.2.1.zip /usr/share/elasticsearch/plugins/analysis-ik/
    cd /usr/share/elasticsearch/plugins/analysis-ik
    unzip elasticsearch-analysis-ik-5.2.1.zip

    /etc/init.d/elasticsearch restart

7.安装head插件

#获取head包
cd /usr/local
git clone git://github.com/mobz/elasticsearch-head.git

#安装依赖
yum install -y gcc-c++ make

#这里nodejs也可以选择4版本的,这里是下载源,如果有其他重复的源,需要删掉老的重复源
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
yum install -y nodejs
cd /usr/local/elasticsearch-head
npm install grunt-cli
npm install grunt
npm install

#编辑head目录下的Gruntfile.js文件
vim Gruntfile.js

                connect: {
                    server: {
                            options: {
                                    port: 9101,        #修改默认端口
                                    hostname: '*',    #这个位置加入这个参数
                                    base: '.',
                                    keepalive: true
                            }
                    }
            }

grunt server &

8.重新启动elasticsearch

    /etc/init.d/elasticsearch restart

9.登陆查看head

 浏览器输入 11.0.0.51:9101

转载于:https://blog.51cto.com/linux1991/2084315

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值