Linux怎么启动Elasticsearch
时间: 2023-12-20 16:51:52 浏览: 87
启动elasticsearch
启动 Elasticsearch 可以使用以下命令:
1. 进入 Elasticsearch 安装目录下的 bin 目录:
```
cd /path/to/elasticsearch/bin/
```
2. 运行以下命令启动 Elasticsearch:
```
./elasticsearch
```
3. 如果 Elasticsearch 成功启动,你将看到类似以下的输出:
```
[2020-11-01T04:30:54,606][INFO ][o.e.n.Node ] [node-1] node name [node-1], node ID [x2kLG2JxR9K7uv8jzHfJXQ], cluster name [elasticsearch]
[2020-11-01T04:30:54,606][INFO ][o.e.n.Node ] [node-1] version[7.9.2], pid[12345], build[default/tar/d34da0ea4a966c4e49417f2da2f244e3e97b4e6e/2020-09-23T00:45:33.626720Z], OS[Linux/3.10.0-1127.19.1.el7.x86_64/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/15/15+36]
[2020-11-01T04:30:54,606][INFO ][o.e.n.Node ] [node-1] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, -Xms1g, -Xmx1g, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/path/to/elasticsearch, -Des.path.conf=/path/to/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
[2020-11-01T04:30:54,607][INFO ][o.e.n.Node ] [node-1] initialized
[2020-11-01T04:30:54,607][INFO ][o.e.n.Node ] [node-1] starting ...
[2020-11-01T04:30:54,663][INFO ][o.e.t.TransportService ] [node-1] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2020-11-01T04:30:54,669][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2020-11-01T04:30:57,696][INFO ][o.e.c.s.MasterService ] [node-1] elected-as-master ([1] nodes joined)[{node-1}{x2kLG2JxR9K7uv8jzHfJXQ}{eFQkAEQwS7mJwRv1P9zA4Q}{127.0.0.1}{127.0.0.1:9300}{dilmrt}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, BECOME_MASTER_TASK, FINISH_ELECTION], term 17, version 2386, delta 4ms
[2020-11-01T04:30:57,707][INFO ][o.e.c.s.ClusterApplierService] [node-1] master node changed {previous [], current [{node-1}{x2kLG2JxR9K7uv8jzHfJXQ}{eFQkAEQwS7mJwRv1P9zA4Q}{127.0.0.1}{127.0.0.1:9300}{dilmrt}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}, term: 17, version: 2386, reason: Publication{term=17, version=2386}
[2020-11-01T04:30:57,853][INFO ][o.e.h.AbstractHttpServerTransport] [node-1] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2020-11-01T04:30:57,854][INFO ][o.e.n.Node ] [node-1] started
[2020-11-01T04:30:57,889][INFO ][o.e.l.LicenseService ] [node-1] license [c3f3f4f9-1b45-4d59-8e6f-6d6ec2d2b8e8] mode [basic] - valid
[2020-11-01T04:30:57,891][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [node-1] Active license is now [BASIC]; Security is disabled
```
其中,`127.0.0.1:9200` 是 Elasticsearch 的 HTTP REST API 地址,可以使用 Web 浏览器或其他 HTTP 客户端访问。而 `127.0.0.1:9300` 是 Elasticsearch 节点之间通信使用的地址,用于集群内部通信。
阅读全文