柚子快報邀請碼778899分享:linux 03
柚子快報邀請碼778899分享:linux 03
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操作系統(tǒng)慢,耐心等待即可。**
啟動報錯,控制臺輸出報錯日志: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,若是出現(xiàn) exception during geoip databases update 錯誤,請參考文末的5.5章節(jié)(部署時可能出現(xiàn)的錯誤解決方法)。

新開一個xshell連接,本地驗證是否啟動成功
curl ‘http://127.0.0.1:9200’
出現(xiàn)如下畫面則說明簡單驗證elasticsearch 啟動成功,說明該版本的安裝包是可以運行的。

### 5、正式部署elsaticsearch
如果服務器配置了彈性IP ,需要拿到本服務器的內(nèi)網(wǎng)ip,不然會啟動不起來,訪問的話照樣是可以用彈性ip進行訪問。
#### (1)獲取本服務器內(nèi)網(wǎng)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 #設置節(jié)點間交互的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功能默認開啟了采集。在默認的啟動下是會去官網(wǎng)的默認地址下獲取最新的Ip的GEO信息,若是不需要則要設置為false ingest.geoip.downloader.enabled: false
#### (3)啟動es主節(jié)點
成功如下圖
#前臺啟動的方式 bin/elasticsearch #后臺啟動方式(推薦使用) bin/elasticsearch -d

#### (4)部署其他節(jié)點
其他節(jié)點和主節(jié)點的部署步驟是一樣的,只是需要把elasticsearch.yml 配置文件的節(jié)點名稱、IP地址等信息修改一下,在這里我就不一一敘述。以下是第二個節(jié)點的配置文件
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 #設置節(jié)點間交互的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功能默認開啟了采集。在默認的啟動下是會去官網(wǎng)的默認地址下獲取最新的Ip的GEO信息,若是不需要則要設置為false ingest.geoip.downloader.enabled: false
#### (5)部署時可能出現(xiàn)的錯誤解決方法
**a、最大虛擬內(nèi)存面積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
添加內(nèi)容如下所示。
soft nofile 65536hard nofile 131072soft nproc 4096hard nproc 4096
修改 /etc/sysctl.conf 文件。增加
vm.max_map_count=262145

修改完成使用命令: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 查看本機內(nèi)網(wǎng)ip,替換到寫錯的ip
**c、exception during geoip databases update 錯誤**
7.16.0版本將GeoIp功能默認開啟了采集。在默認的啟動下是會去官網(wǎng)的默認地址下獲取最新的Ip的GEO信息,若是不需要則要設置為false
#此版本將GeoIp功能默認開啟了采集。在默認的啟動下是會去官網(wǎng)的默認地址下獲取最新的Ip的GEO信息,若是不需要則要設置為false ingest.geoip.downloader.enabled: false
### 6、X-Pack 安全配置
X-Pack 安全配置和之前設置的方式是一樣的,在這里我就不一一敘述了。請參考以下文章中關于X-Paxk安全配置的內(nèi)容。
《06\_Elasticsearch 7.4.2集群部署以及X-Pack 安全配置(Es、kibana)【超詳細版】》
### 7、其他可選配置項
#### (1)修改 JVM 參數(shù)
注意點:
* 機器內(nèi)存可能不夠,就需要修改 JVM 參數(shù),配置文件路徑為 config/jvm.options,ES V7.1 版本之后默認為 1g, 老版本為2g,可自行修改。
* Xmx 和Xms 數(shù)值請設置相同;
* Xmx 不要超過機器內(nèi)存的 50%;
* 內(nèi)存總量不要超過 30GB,
參見官方文檔 https://www.elastic.co/cn/blog/a-heap-of-trouble;

>
> 本文章收錄于【國產(chǎn)銀河服務器安裝文檔集】,將詳細的講解 國產(chǎn)銀河服務器操作系統(tǒng)各種軟件的部署與說明。
>
>
>
柚子快報邀請碼778899分享:linux 03
精彩內(nèi)容
本文內(nèi)容根據(jù)網(wǎng)絡資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉載請注明,如有侵權,聯(lián)系刪除。