https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-16-0
kibana 官网下载地址:
https://www.elastic.co/cn/downloads/past-releases/kibana-7-16-0
下载好之后把安装包通过xftp或者scp的方式放到服务器相应的文件夹中
二、进行elasticsearch 7.16.0 安装部署
安装路径:/usr/local/geoStar/
1、解压安装包
tar -zxvf elasticsearch-7.16.0-linux-x86_64.tar.gz
2、创建es 账号
useradd es
3、改变文件夹的归属
chown -R es:es /usr/local/geoStar/elasticsearch-7.16.0
4、先简单验证是否能够启动
前台方式启动es
#切换到es账户
su es
#进入es文件夹
cd /usr/local/geoStar/elasticsearch-7.16.0
#前台方式启动es
bin/elasticsearch
由于兼容性不是很好,启动的时候会比CentOS 7.6操作系统慢,耐心等待即可。
启动报错,控制台输出报错日志:ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [linux-aarch64]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml]
org.elasticsearch.bootstrap.StartupException: ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [linux-aarch64]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:174) ~[elasticsearch-7.6.1.jar:7.6.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.6.1.jar:7.6.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.6.1.jar:7.6.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.6.1.jar:7.6.1]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.6.1.jar:7.6.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.6.1.jar:7.6.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.6.1.jar:7.6.1]
错误日志也说的比较清楚,由于有些X-Pack特性不支持,故需要修改配置文件elasticsearch.yml
vi config/elasticsearch.yml
在elasticsearch.yml 文件最后面添加配置
#设置为false以禁用X-Pack机器学习功能。
xpack.ml.enabled: false
然后重新启动,当看到如下提示则说明启动ok,若是出现 exception during geoip databases update 错误,请参考文末的5.5章节(部署时可能出现的错误解决方法)。
新开一个xshell连接,本地验证是否启动成功
curl 'http://127.0.0.1:9200'
出现如下画面则说明简单验证elasticsearch 启动成功,说明该版本的安装包是可以运行的。
5、正式部署elsaticsearch
如果服务器配置了弹性IP ,需要拿到本服务器的内网ip,不然会启动不起来,访问的话照样是可以用弹性ip进行访问。
(1)获取本服务器内网ip地址
使用ifconfig 命令查看ip地址时,首先要确保登陆用户为root,因为ifconfig在etc目录下
su root
ifconfig
(2)elasticsearch.yml 配置文件增加配置
完整的配置如下
cluster.name: nanshanPre
node.name: es01
node.master: true
node.data: true
path.data: /usr/local/geoStar/elasticsearch-7.16.0/data
path.logs: /usr/local/geoStar/elasticsearch-7.16.0/logs
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 192.168.10.70
http.port: 9200
#设置节点间交互的tcp端口,默认是9300。
transport.tcp.port: 9300
discovery.seed_hosts: ["192.168.10.70:9300","192.168.10.187:9200"]
cluster.initial_master_nodes: es01
action.destructive_requires_name: true
## 开启跨域访问(配置文件末尾添加即可)
http.cors.enabled: true
http.cors.allow-origin: "*"
#设置为false以禁用X-Pack机器学习功能。
xpack.ml.enabled: false
#此版本将GeoIp功能默认开启了采集。在默认的启动下是会去官网的默认地址下获取最新的Ip的GEO信息,若是不需要则要设置为false
ingest.geoip.downloader.enabled: false
(3)启动es主节点
成功如下图
#前台启动的方式
bin/elasticsearch
#后台启动方式(推荐使用)
bin/elasticsearch -d
(4)部署其他节点
其他节点和主节点的部署步骤是一样的,只是需要把elasticsearch.yml 配置文件的节点名称、IP地址等信息修改一下,在这里我就不一一叙述。以下是第二个节点的配置文件
cluster.name: nanshanPre
node.name: es02
node.master: true
node.data: true
path.data: /usr/local/geoStar/elasticsearch-7.16.0/data
path.logs: /usr/local/geoStar/elasticsearch-7.16.0/logs
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 192.168.10.187
http.port: 9200
#设置节点间交互的tcp端口,默认是9300。
transport.tcp.port: 9300
discovery.seed_hosts: ["192.168.10.70:9300","192.168.10.187:9200"]
cluster.initial_master_nodes: es01
action.destructive_requires_name: true
### 开启跨域访问(配置文件末尾添加即可)
http.cors.enabled: true
http.cors.allow-origin: "*"
##设置为false以禁用X-Pack机器学习功能。
xpack.ml.enabled: false
##此版本将GeoIp功能默认开启了采集。在默认的启动下是会去官网的默认地址下获取最新的Ip的GEO信息,若是不需要则要设置为false
ingest.geoip.downloader.enabled: false
(5)部署时可能出现的错误解决方法
a、最大虚拟内存面积vm不足
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2021-11-14T13:36:28,468][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2021-11-14T13:36:28,473][ERROR][o.e.b.Bootstrap ] [node-1] node validation exception
[1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方法:
需要切换到root用户修改配置。修改/etc/security/limits.conf 文件
vi /etc/security/limits.conf
添加内容如下所示。
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
/etc/security/limits.conf 文件
vi /etc/security/limits.conf
添加内容如下所示。
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
[外链图片转存中…(img-k2rAJlDJ-1725981309108)]
[外链图片转存中…(img-OPdyXoqn-1725981309108)]
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新