title: deepin下安装ElasticSearch
安装
安装elasticsearch
下载
从官网上查看最新的版本,获取下载链接。本文撰写时,最新的版本是`5.4.1`。因此,使用的地址方式如下:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.zip
解压
由于我下载的是ZIP
包,因此使用的`unzip`来解压缩。
unzip elasticsearch-5.4.1.zip
安装kibana
下载
从官网上查看最新的版本,获取下载链接。本文撰写时,最新的版本是`5.4.1`。因此,使用的地址方式如下:
https://artifacts.elastic.co/downloads/kibana/kibana-5.4.1-linux-x86_64.tar.gz
解压
由于我下载的是tar.gz
包,因此使用的`tar`来解压缩。
tar -xzvf kibana-5.4.1-linux-x86_64.tar.gz
安装X-Pack到elasticsearch
解压后,进入elasticsearch-5.4.1
cd elasticsearch-5.4.1/
参考X-Pack
的官网来进行安装
./bin/elasticsearch-plugin install x-pack
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
-> Downloading x-pack from elastic
[=================================================] 100%
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.io.FilePermission \\.\pipe\* read,write
* java.lang.RuntimePermission accessClassInPackage.com.sun.activation.registries
* java.lang.RuntimePermission getClassLoader
* java.lang.RuntimePermission setContextClassLoader
* java.lang.RuntimePermission setFactory
* java.security.SecurityPermission createPolicy.JavaPolicy
* java.security.SecurityPermission getPolicy
* java.security.SecurityPermission putProviderProperty.BC
* java.security.SecurityPermission setPolicy
* java.util.PropertyPermission * read,write
* java.util.PropertyPermission sun.nio.ch.bugLevel write
* javax.net.ssl.SSLPermission setHostnameVerifier
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.
Continue with installation? [y/N]y
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin forks a native controller @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
This plugin launches a native controller that is not subject to the Java
security manager nor to system call filters.
Continue with installation? [y/N]y
-> Installed x-pack
安装X-Pack到kibana
./bin/kibana-plugin install x-pack
Attempting to transfer from x-pack
Attempting to transfer from https://artifacts.elastic.co/downloads/kibana-plugins/x-pack/x-pack-5.4.1.zip
Transferring 119988917 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Extracting plugin archive
Extraction complete
Optimizing and caching browser bundles...
Plugin installation complete
启动
启动是很简单的,直接使用./bin/**strong text**elasticsearch
来启动
$ ./bin/elasticsearch
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
[2017-06-07T23:29:10,692][INFO ][o.e.n.Node ] [] initializing ...
[2017-06-07T23:29:10,780][INFO ][o.e.e.NodeEnvironment ] [-STZwly] using [1] data paths, mounts [[/ (/dev/sda4)]], net usable_space [17.2gb], net total_space [81.1gb], spins? [no], types [ext4]
[2017-06-07T23:29:10,780][INFO ][o.e.e.NodeEnvironment ] [-STZwly] heap size [1.9gb], compressed ordinary object pointers [unknown]
[2017-06-07T23:29:10,782][INFO ][o.e.n.Node ] node name [-STZwly] derived from node ID [-STZwlykRYKmZoMYC8XOQQ]; set [node.name] to override
[2017-06-07T23:29:10,782][INFO ][o.e.n.Node ] version[5.4.1], pid[7087], build[2cfe0df/2017-05-29T16:05:51.443Z], OS[Linux/4.9.0-deepin4-amd64/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_65/25.65-b01]
[2017-06-07T23:29:10,783][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -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, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/home/admin/elasticsearch-5.4.1, -Dawt.useSystemAAFontSettings=gasp]
[2017-06-07T23:29:12,598][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [aggs-matrix-stats]
[2017-06-07T23:29:12,598][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [ingest-common]
[2017-06-07T23:29:12,598][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [lang-expression]
[2017-06-07T23:29:12,598][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [lang-groovy]
[2017-06-07T23:29:12,599][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [lang-mustache]
[2017-06-07T23:29:12,599][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [lang-painless]
[2017-06-07T23:29:12,599][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [percolator]
[2017-06-07T23:29:12,599][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [reindex]
[2017-06-07T23:29:12,599][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [transport-netty3]
[2017-06-07T23:29:12,599][INFO ][o.e.p.PluginsService ] [-STZwly] loaded module [transport-netty4]
[2017-06-07T23:29:12,600][INFO ][o.e.p.PluginsService ] [-STZwly] loaded plugin [x-pack]
[2017-06-07T23:29:14,841][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.XPackPlugin
[2017-06-07T23:29:15,450][INFO ][o.e.d.DiscoveryModule ] [-STZwly] using discovery type [zen]
[2017-06-07T23:29:16,413][INFO ][o.e.n.Node ] initialized
[2017-06-07T23:29:16,414][INFO ][o.e.n.Node ] [-STZwly] starting ...
[2017-06-07T23:29:16,739][INFO ][o.e.t.TransportService ] [-STZwly] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-06-07T23:29:16,751][WARN ][o.e.b.BootstrapChecks ] [-STZwly] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2017-06-07T23:29:19,836][INFO ][o.e.c.s.ClusterService ] [-STZwly] new_master {-STZwly}{-STZwlykRYKmZoMYC8XOQQ}{DrKK_BKwQemJ8eu-Jsr5IA}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-06-07T23:29:19,862][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [-STZwly] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-06-07T23:29:19,873][INFO ][o.e.n.Node ] [-STZwly] started
[2017-06-07T23:29:20,055][INFO ][o.e.g.GatewayService ] [-STZwly] recovered [0] indices into cluster_state
[2017-06-07T23:29:21,134][INFO ][o.e.l.LicenseService ] [-STZwly] license [d32f5e71-e8ac-44f2-bea1-4a5170e464d0] mode [trial] - valid
[2017-06-07T23:29:26,618][INFO ][o.e.c.m.MetaDataCreateIndexService] [-STZwly] [.monitoring-data-2] creating index, cause [auto(bulk api)], templates [.monitoring-data-2], shards [1]/[1], mappings [node, _default_, logstash, cluster_info, kibana]
[2017-06-07T23:29:26,900][INFO ][o.e.c.m.MetaDataCreateIndexService] [-STZwly] [.monitoring-es-2-2017.06.07] creating index, cause [auto(bulk api)], templates [.monitoring-es-2], shards [1]/[1], mappings [node, _default_, shards, index_stats, index_recovery, cluster_state, cluster_stats, indices_stats, node_stats]
[2017-06-07T23:29:27,364][INFO ][o.e.c.m.MetaDataCreateIndexService] [-STZwly] [.watches] creating index, cause [auto(bulk api)], templates [watches], shards [1]/[1], mappings [watch]
[2017-06-07T23:29:27,689][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.monitoring-es-2-2017.06.07/1-8GhbqMQc6vdq6_ozO8rQ] update_mapping [cluster_stats]
[2017-06-07T23:29:27,713][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.watches/e0QOrj7qQmSPFJMJpQOqiA] update_mapping [watch]
[2017-06-07T23:29:28,014][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.monitoring-es-2-2017.06.07/1-8GhbqMQc6vdq6_ozO8rQ] update_mapping [node_stats]
[2017-06-07T23:29:36,539][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.monitoring-es-2-2017.06.07/1-8GhbqMQc6vdq6_ozO8rQ] update_mapping [index_stats]
[2017-06-07T23:29:36,678][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.monitoring-es-2-2017.06.07/1-8GhbqMQc6vdq6_ozO8rQ] update_mapping [cluster_stats]
[2017-06-07T23:29:36,803][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.monitoring-es-2-2017.06.07/1-8GhbqMQc6vdq6_ozO8rQ] update_mapping [indices_stats]
[2017-06-07T23:30:28,547][INFO ][o.e.c.m.MetaDataCreateIndexService] [-STZwly] [.triggered_watches] creating index, cause [auto(bulk api)], templates [triggered_watches], shards [1]/[1], mappings [triggered_watch]
[2017-06-07T23:30:28,825][INFO ][o.e.c.m.MetaDataCreateIndexService] [-STZwly] [.watcher-history-3-2017.06.07] creating index, cause [auto(bulk api)], templates [watch_history_3], shards [1]/[1], mappings [watch_record]
[2017-06-07T23:30:28,907][INFO ][o.e.c.m.MetaDataCreateIndexService] [-STZwly] [.monitoring-alerts-2] creating index, cause [auto(bulk api)], templates [.monitoring-alerts-2], shards [1]/[1], mappings [doc]
[2017-06-07T23:30:28,956][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.watcher-history-3-2017.06.07/L7TO6EupTc6SRn8z3F1kiA] update_mapping [watch_record]
[2017-06-07T23:30:29,086][INFO ][o.e.c.m.MetaDataMappingService] [-STZwly] [.watcher-history-3-2017.06.07/L7TO6EupTc6SRn8z3F1kiA] update_mapping [watch_record]
一个问题
如果出现类似于下面的提示:
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-x86/libjnidispatch.so) not found in resource path
解决方法是,从下面的地址下载最新的JNA-4.4.0.jar
替换elasticsearch/lib/jna-4.4.0.jar
https://github.com/java-native-access/jna
如果出现类似于下面的提示:
ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [linux-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml]
解决方法是:
在config/elasticsearch.yml
添加一条配置:
xpack.ml.enabled: false
访问
如果成功的启动后,我们可以新开一个终端,使用curl
来发送一次请求
curl 'http://localhost:9200/?pretty'
{
"error" : {
"root_cause" : [
{
"type" : "security_exception",
"reason" : "missing authentication token for REST request [/?pretty]",
"header" : {
"WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type" : "security_exception",
"reason" : "missing authentication token for REST request [/?pretty]",
"header" : {
"WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status" : 401
}