查看linux服务器信息

[root@linux-node2 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@linux-node2 ~]# uname -r
2.6.32-573.el6.x86_64

1,安装 elasticsearch

[root@linux-node2 ~]# useradd es;

[root@linux-node2 ~]# su es;

#dowload es gzip 包

解压文件:

[es@linux-node2 ~]# tar -xvf elasticsearch-7.5.1-linux-x86_64.tar.gz

[es@linux-node2 ~]# ln -s elasticsearch-7.5.1-linux-x86_64.tar.gz es9200

修改配置文件:

[es@linux-node2 ~] vim es-9200/config/elasticsearch.yml

cluster.name: esapp
node.name: node-1
path.data: /app/soft/es9200/data
path.logs: /app/soft/es9200/logs
bootstrap.memory_lock: true
network.host: 0.0.0.0
discovery.seed_hosts: [“127.0.0.1″,”192.168.9.93”]
cluster.initial_master_nodes: [“node-1”]

:wq

后台启动,注意用户不能是root

[es@linux-node2 ~] es9200/bin/./elasticsearch -d

查看日志,监控是否正常启动成功

[es@linux-node2 ~] tail -fn 100 logs/esapp.log

 

浏览器访问:

http://192.168.9.93:9200/

返回:

{
  "name" : "node-1",
  "cluster_name" : "esapp",
  "cluster_uuid" : "9zDDCRiXQdOtAk9wQIMVEg",
  "version" : {
    "number" : "7.5.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "3ae9ac9a93c95bd0cdc054951cf95d88e1e18d96",
    "build_date" : "2019-12-16T22:57:37.835892Z",
    "build_snapshot" : false,
    "lucene_version" : "8.3.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

常见不能正常启动需要手动修改 centos7的配置如下:

针对问题逐一修改:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

#切换到root用户修改
vim /etc/security/limits.conf

# 在最后面追加下面内容
es hard nofile 65536
es soft nofile 65536

[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]

cd /etc/security/limits.d
vim 90-nproc.conf
add :es soft nproc 5000

[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

vim /etc/sysctl.conf
#追加下面这个参数
vm.max_map_count=262144

马上应用: sysctl -p

[4] 强制完全使用内存
修改:
vim /etc/security/limits.conf
es soft memlock unlimited
es hard memlock unlimited
修改:
vim /etc/sysctl.conf
vm.swappiness=0

如果启动失败,则需要查询centos的内核的版本,版本号大于4.x
升级内核至4.4.121(更新nss yum -y update nss)
1.>导入public key
rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2.>安装ELRepo到CentOS-6.5中
rpm -ivh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
3.>安装**kernel-lt(lt=long-term)**
yum –enablerepo=elrepo-kernel install kernel-lt -y
或者安装kernel-ml(ml=mainline)
yum –enablerepo=elrepo-kernel install kernel-ml -y
4.>编辑grub.conf文件,修改Grub引导顺序
#vim /etc/grub.conf
default 改为刚新安装的内核 下标0开始

确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0
5.>重启,查看内核版本号.
[root@localhost ~]# reboot
[root@iZ23no5ghyqZ bin]# uname -a
Linux iZ23no5ghyqZ 4.4.121-1.el6.elrepo.x86_64 #1 SMP Sun Mar 11 16:08:55 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
至此,CentOS6.5的内核升级完成

测试启动成功:
http://192.168.9.93:9200/

 

下一篇 ELK环境搭建之安装 kibana-7.5.1-linux-x86_64

 


0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

蜀ICP备16001794号
© 2014 - 2024 linpxing.cn All right reserved.