gaojingsong 阅读(1068) 评论(0)

[root@node1 bin]# java -version

java version "1.8.0_111"

Java(TM) SE Runtime Environment (build 1.8.0_111-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

[root@node1 bin]# sh /opt/es5.0/init_env.sh 

[root@node1 bin]# sh elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.1.2.0/elasticsearch-sql-5.1.2.0.zip

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/plugins/PluginCli : Unsupported major.minor version 52.0

        at java.lang.ClassLoader.defineClass1(Native Method)

        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

错误原因 :-->环境变量捣的鬼



 为了避免用户权限所属组纠纷,还是用非root用户启动,因为ES也需要非Root账号启动

[root@node1 bin]# su - hadoop

[hadoop@node1 ~]$ cd /opt/es5.0/elasticsearch-5.1.2/bin/

[hadoop@node1 bin]$  sh elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.1.2.0/elasticsearch-sql-5.1.2.0.zip

-> Downloading https://github.com/NLPchina/elasticsearch-sql/releases/download/5.1.2.0/elasticsearch-sql-5.1.2.0.zip

[=================================================] 100% 

-> Installed sql

[hadoop@node1 bin]$ ./elasticsearch

[2017-02-26T12:41:11,783][WARN ][o.e.b.JNANatives         ] unable to install syscall filter: 

java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in

[2017-02-26T12:41:14,274][INFO ][o.e.n.Node               ] [node-1] initializing ...

[2017-02-26T12:41:14,780][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] data paths, mounts [[/ (/dev/hdc2)]], net usable_space [7.5gb], net total_space [17.1gb], spins? [possibly], types [ext3]

[2017-02-26T12:41:14,781][INFO ][o.e.e.NodeEnvironment    ] [node-1] heap size [1.9gb], compressed ordinary object pointers [true]

[2017-02-26T12:41:14,783][INFO ][o.e.n.Node               ] [node-1] node name [node-1], node ID [EdHbn3S_Sxm4Cwz0pMxwRQ]

[2017-02-26T12:41:14,805][INFO ][o.e.n.Node               ] [node-1] version[5.1.2], pid[3933], build[c8c4c16/2017-01-11T20:18:39.146Z], OS[Linux/2.6.18-128.el5/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_111/25.111-b14]

[2017-02-26T12:41:22,656][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [aggs-matrix-stats]

[2017-02-26T12:41:22,657][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-common]

[2017-02-26T12:41:22,657][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-expression]

[2017-02-26T12:41:22,658][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-groovy]

[2017-02-26T12:41:22,658][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-mustache]

[2017-02-26T12:41:22,659][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-painless]

[2017-02-26T12:41:22,660][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [percolator]

[2017-02-26T12:41:22,661][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [reindex]

[2017-02-26T12:41:22,661][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty3]

[2017-02-26T12:41:22,661][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty4]

[2017-02-26T12:41:22,663][INFO ][o.e.p.PluginsService     ] [node-1] loaded plugin [sql]

[2017-02-26T12:41:38,927][INFO ][o.e.n.Node               ] [node-1] initialized

[2017-02-26T12:41:38,927][INFO ][o.e.n.Node               ] [node-1] starting ...

[2017-02-26T12:41:40,002][INFO ][o.e.m.j.JvmGcMonitorService] [node-1] [gc][1] overhead, spent [279ms] collecting in the last [1s]

[2017-02-26T12:41:41,364][INFO ][o.e.t.TransportService   ] [node-1] publish_address {192.168.1.104:9300}, bound_addresses {192.168.1.104:9300}

[2017-02-26T12:41:41,376][INFO ][o.e.b.BootstrapCheck     ] [node-1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks

[2017-02-26T12:41:44,644][INFO ][o.e.c.s.ClusterService   ] [node-1] new_master {node-1}{EdHbn3S_Sxm4Cwz0pMxwRQ}{93Rt968OTIqVGUKMNIIdaw}{192.168.1.104}{192.168.1.104:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)

[2017-02-26T12:41:44,736][INFO ][o.e.h.HttpServer         ] [node-1] publish_address {192.168.1.104:9200}, bound_addresses {192.168.1.104:9200}

[2017-02-26T12:41:44,738][INFO ][o.e.n.Node               ] [node-1] started

[2017-02-26T12:41:44,824][INFO ][o.e.g.GatewayService     ] [node-1] recovered [0] indices into cluster_state

老路走不通,需要重新开辟道路了,旧版这个访问时OK的,新版本就歇菜了


 重新开辟道路,使用Tomcat服务器

[root@node1 ~]# cd /root/

[root@node1 ~]# ls

anaconda-ks.cfg                grafana-1.9.1.tar.gz

apache-flume-1.6.0-bin.tar.gz  influxdb-0.9.4.2-1.x86_64.rpm

apache-tomcat-7.0.67.zip       install.log

collectd-5.5.0                 install.log.syslog

collectd-5.5.0.tar.gz          jdk-7u67-linux-x64.rpm

Desktop                        kafka_2.9.1-0.8.2.2.tgz

elasticsearch-2.1.1.rpm        kibana-4.3.1-linux-x64.tar.gz

elasticsearch-2.1.1.tar.gz     logstash-2.1.1.tar.gz

facette-0.3.0                  tomcat7

facette-0.3.0.tar.gz

[root@node1 ~]# cd tomcat7/

[root@node1 tomcat7]# ls

bin   lib      logs    RELEASE-NOTES  temp     work

conf  LICENSE  NOTICE  RUNNING.txt    webapps

[root@node1 tomcat7]# cd webapps/

[root@node1 webapps]# ls

doc  docs  examples  host-manager  manager  ROOT

[root@node1 webapps]# pwd

/root/tomcat7/webapps

[root@node1 webapps]# cd /opt/es5.0/

[root@node1 es5.0]# ls

elasticsearch-5.1.2            init_env.sh

elasticsearch-5.1.2.zip        jdk1.8.0_111

elasticsearch-head-master.zip  jdk-8u111-linux-x64.tar.gz

elasticsearch-sql-5.1.2.0.zip  s

[root@node1 es5.0]# unzip elasticsearch-sql-5.1.2.0.zip

 [root@node1 es5.0]# ls

elasticsearch        elasticsearch-5.1.2.zip        elasticsearch-sql-5.1.2.0.zip  jdk1.8.0_111                s

elasticsearch-5.1.2  elasticsearch-head-master.zip  init_env.sh                    jdk-8u111-linux-x64.tar.gz

[root@node1 es5.0]# cd elasticsearch

[root@node1 elasticsearch]# ls

druid.jar  elasticsearch-sql-5.1.2.0.jar  elasticsearch-sql-5.1.2.0-sources.jar  guava.jar  plugin-descriptor.properties  _site

[root@node1 elasticsearch]# cd ../

[root@node1 es5.0]# mv elasticsearch /root/tomcat7/webapps/ROOT/

[root@node1 es5.0]# cd /root/tomcat7/bin/

[root@node1 bin]# ./startup.sh 

Using CATALINA_BASE:   /root/tomcat7

Using CATALINA_HOME:   /root/tomcat7

Using CATALINA_TMPDIR: /root/tomcat7/temp

Using JRE_HOME:        /usr/java/jdk1.7.0_67

Using CLASSPATH:       /root/tomcat7/bin/bootstrap.jar:/root/tomcat7/bin/tomcat-juli.jar

Tomcat started.

[root@node1 bin]# jps

3933 Elasticsearch

4111 Jps

4110 Bootstrap

[root@node1 bin]# ps -ef |grep 4110

root      4110     1  3 12:55 pts/1    00:00:01 /usr/java/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/root/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/root/tomcat7/endorsed -classpath /root/tomcat7/bin/bootstrap.jar:/root/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/root/tomcat7 -Dcatalina.home=/root/tomcat7 -Djava.io.tmpdir=/root/tomcat7/temp org.apache.catalina.startup.Bootstrap start

[root@node1 bin]# netstat -tnpl |grep java

tcp        0      0 :::8009                     :::*                        LISTEN      4110/java           

tcp        0      0 :::8080                     :::*                        LISTEN      4110/java           

tcp        0      0 ::ffff:192.168.1.104:9200   :::*                        LISTEN      3933/java           

tcp        0      0 ::ffff:192.168.1.104:9300   :::*                        LISTEN      3933/java           

[root@node1 bin]#  curl -XPUT 'http://localhost:9200/users/user/1' -d '{

>   "user":kimchy",

>   "post_date":"2012-12-12",

>   "message":"trying out ElasticSearch!"

> }'

curl: (7) couldn't connect to host

[root@node1 bin]#  curl -XPUT 'http://192.168.1.104:9200/users/user/1' -d '{

>   "user":kimchy",

>   "post_date":"2012-12-12",

>   "message":"trying out ElasticSearch!"

> }'

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'kimchy': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@53b549fe; line: 2, column: 17]"}},"status":400}[root@node1 bin]# 

[root@node1 bin]# 

[root@node1 bin]# 

[root@node1 bin]# 

[root@node1 bin]#  curl -XPUT 'http://192.168.1.104:9200/users/user/1' -d '{

>   "user":kimchy",

>   "message":"trying out ElasticSearch!"

> }'

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'kimchy': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@26d9b754; line: 2, column: 17]"}},"status":400}[root@node1 bin]# 

[root@node1 bin]# 

[root@node1 bin]# 

[root@node1 bin]#  curl -XPUT 'http://192.168.1.104:9200/users/user/1' -d '{

>   "user":"kimchy",

>   "message":"trying out ElasticSearch!"

> }'

{"_index":"users","_type":"user","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"created":true}[root@node1 bin]# 

[root@node1 bin]# 

[root@node1 bin]# pwd

/root/tomcat7/bin

[root@node1 bin]# cd ../

 


 还是失败,



 查看官方手册



再次替换

 [root@node1 tomcat7]# cd /root/tomcat7/webapps

[root@node1 webapps]# ls

doc  docs  es-sql-site-standalone.zip  examples  host-manager  manager  ROOT

[root@node1 webapps]# unzip es-sql-site-standalone.zip 

 

[root@node1 webapps]# ls

doc  docs  es-sql-site  es-sql-site-standalone.zip  examples  host-manager  manager  ROOT

[root@node1 webapps]# mv es-sql-site ROOT/

[root@node1 webapps]# ls

doc  docs  es-sql-site  es-sql-site-standalone.zip  examples  host-manager  manager  ROOT

再次访问,还是歇菜了


    # 增加新的参数,这样插件可以访问es

#http.cors.enabled: true
#http.cors.allow-origin: “*"

 修改参数重启ES,再次尝试

1)新地址好用,测试ok,都是http.cors惹的祸



 2)测试非独立SQL插件,也是好用的,看来不是插件问题而是参数问题


 

  • 大小: 100.6 KB
  • 大小: 37.1 KB
  • 大小: 37.1 KB
  • 大小: 75.9 KB
  • 大小: 56.3 KB
  • 大小: 54.4 KB
  • 大小: 15.5 KB
  • 大小: 53.2 KB
  • 大小: 58.6 KB
  • 大小: 61.5 KB