03_Linux ARM架构-安装elasticsearch 7

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章节(部署时可能出现的错误解决方法)。


![122dc8fbf51feb20654f132e96dc439c.png](https://img-blog.csdnimg.cn/img_convert/122dc8fbf51feb20654f132e96dc439c.png)


新开一个xshell连接,本地验证是否启动成功



curl ‘http://127.0.0.1:9200’


出现如下画面则说明简单验证elasticsearch 启动成功,说明该版本的安装包是可以运行的。


![b0f56bd5ab02fec478ac8a07c56b0444.png](https://img-blog.csdnimg.cn/img_convert/b0f56bd5ab02fec478ac8a07c56b0444.png)


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


![cd88d64a88c09a4c1efeea2e7d391d9b.png](https://img-blog.csdnimg.cn/img_convert/cd88d64a88c09a4c1efeea2e7d391d9b.png)


#### (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


添加内容如下所示。



  • soft nofile 65536
  • hard nofile 131072
  • soft nproc 4096
  • hard nproc 4096

修改 /etc/sysctl.conf 文件。增加



vm.max_map_count=262145


![8fc2fcab802c1020a3afa91aaa1c822a.png](https://img-blog.csdnimg.cn/img_convert/8fc2fcab802c1020a3afa91aaa1c822a.png)


修改完成使用命令:sysctl -p 刷新使用


**b、配置文件ip地址写的不对**


org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300]]; nested: BindException[无法指定被请求的地址];



org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300]]; nested: BindException[无法指定被请求的地址];
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]
BindTransportException[Failed to bind to [9300]]; nested: BindException[无法指定被请求的地址];
Likely root cause: java.net.BindException: 无法指定被请求的地址
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
at io.netty.channel.AbstractChannel A b s t r a c t U n s a f e . b i n d ( A b s t r a c t C h a n n e l . j a v a : 551 ) a t i o . n e t t y . c h a n n e l . D e f a u l t C h a n n e l P i p e l i n e AbstractUnsafe.bind(AbstractChannel.java:551) at io.netty.channel.DefaultChannelPipeline AbstractUnsafe.bind(AbstractChannel.java:551)atio.netty.channel.DefaultChannelPipelineHeadContext.bind(DefaultChannelPipeline.java:1346)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:985)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:247)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:344)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:510)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:518)
at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)


**解决办法**:使用ifconfig 查看本机内网ip,替换到写错的ip


**c、exception during geoip databases update 错误**


7.16.0版本将GeoIp功能默认开启了采集。在默认的启动下是会去官网的默认地址下获取最新的Ip的GEO信息,若是不需要则要设置为false



#此版本将GeoIp功能默认开启了采集。在默认的启动下是会去官网的默认地址下获取最新的Ip的GEO信息,若是不需要则要设置为false
ingest.geoip.downloader.enabled: false


### 6、X-Pack 安全配置


X-Pack 安全配置和之前设置的方式是一样的,在这里我就不一一叙述了。请参考以下文章中关于X-Paxk安全配置的内容。


《06\_Elasticsearch 7.4.2集群部署以及X-Pack 安全配置(Es、kibana)【超详细版】》


### 7、其他可选配置项


#### (1)修改 JVM 参数


注意点:


* 机器内存可能不够,就需要修改 JVM 参数,配置文件路径为 config/jvm.options,ES V7.1 版本之后默认为 1g, 老版本为2g,可自行修改。
* Xmx 和Xms 数值请设置相同;
* Xmx 不要超过机器内存的 50%;
* 内存总量不要超过 30GB,

 参见官方文档 https://www.elastic.co/cn/blog/a-heap-of-trouble;


![2a2c6ce9c11e6458546dd992f558d7ae.png](https://img-blog.csdnimg.cn/img_convert/2a2c6ce9c11e6458546dd992f558d7ae.png)


< END >



> 
> 本文章收录于【国产银河服务器安装文档集】,将详细的讲解 国产银河服务器操作系统各种软件的部署与说明。
> 
> 
> 


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值