elasticsearch-sql.就是通过sql语句去操作es集群.就是将sql语句给转成了es的查询语法.感觉非常好用.这里分享一下安装过程,注意:插件在国内被和谐了。需要想办法下载,附件给出2.1.1版本的SQL插件供下载。
一、查看安装手册
[root@node1 bin]# ./plugin
ERROR: command not specified
NAME
plugin - Manages plugins
SYNOPSIS
plugin <command>
DESCRIPTION
Manage plugins
COMMANDS
install Install a plugin
remove Remove a plugin
list List installed plugins
NOTES
[*] For usage help on specific commands please type "plugin <command> -h"
[root@node1 bin]# ./plugin install -h
NAME
install - Install a plugin
SYNOPSIS
plugin install <name or url>
DESCRIPTION
This command installs an elasticsearch plugin. It can be used as follows:
Officially supported or commercial plugins require just the plugin name:
plugin install analysis-icu
plugin install shield
Plugins from GitHub require 'username/repository' or 'username/repository/version':
plugin install lmenezes/elasticsearch-kopf
plugin install lmenezes/elasticsearch-kopf/1.5.7
Plugins from Maven Central or Sonatype require 'groupId/artifactId/version':
plugin install org.elasticsearch/elasticsearch-mapper-attachments/2.6.0
Plugins can be installed from a custom URL or file location as follows:
plugin install http://some.domain.name//my-plugin-1.0.0.zip
plugin install file:/path/to/my-plugin-1.0.0.zip
OFFICIAL PLUGINS
The following plugins are officially supported and can be installed by just referring to their name
- analysis-icu
- analysis-kuromoji
- analysis-phonetic
- analysis-smartcn
- analysis-stempel
- cloud-aws
- cloud-azure
- cloud-gce
- delete-by-query
- discovery-multicast
- lang-javascript
- lang-python
- mapper-murmur3
- mapper-size
OPTIONS
-t,--timeout Timeout until the plugin download is abort
-v,--verbose Verbose output
-h,--help Shows this message
二、开始安装
[root@node1 bin]# ./plugin install file:/opt/elasticsearch-2.1.1/elasticsearch-sql-2.1.1.1.zip
-> Installing from file:/opt/elasticsearch-2.1.1/elasticsearch-sql-2.1.1.1.zip...
Trying file:/opt/elasticsearch-2.1.1/elasticsearch-sql-2.1.1.1.zip ...
Downloading .......................................DONE
Verifying file:/opt/elasticsearch-2.1.1/elasticsearch-sql-2.1.1.1.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed sql into /opt/elasticsearch-2.1.1/plugins/sql
[root@node1 bin]# ./elasticsearch -d
[root@node1 bin]# Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
[root@node1 bin]# su - hadoop
[hadoop@node1 ~]$ cd /opt/elasticsearch-2.1.1/bin/
[hadoop@node1 bin]$ ./elasticsearch -d
三、验证
[hadoop@node1 bin]$ curl -XGET 192.168.1.101:9200
{
"name" : "node-1",
"cluster_name" : "my-application",
"version" : {
"number" : "2.1.1",
"build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
"build_timestamp" : "2015-12-15T13:05:55Z",
"build_snapshot" : false,
"lucene_version" : "5.3.1"
},
"tagline" : "You Know, for Search"
}
[hadoop@node1 bin]$ curl -XGET 192.168.1.101:9200/_plugin/sql
<head><meta http-equiv="refresh" content="0; URL=/_plugin/sql/"></head>[hadoop@node1 bin]$