windows下的安装即开箱即用,到bin目录下打开elasticsearch.bat,访问localhost:9200,页面显示:
{ "name" : "Windshear", "cluster_name" : "elasticsearch", "version" : { "number" : "2.3.5", "build_hash" : "90f439ff60a3c0f497f91663701e64ccd01edbb4", "build_timestamp" : "2016-07-27T10:36:52Z", "build_snapshot" : false, "lucene_version" : "5.5.0" }, "tagline" : "You Know, for Search" }
发送post请求,将需要添加的信息放到body中:
http://localhost:9200/myindex/share/1 body: { "url": "www.baidu.com", "place": "Beijing", "company": "Baidu" }
而后用get请求获取到该消息:
http://localhost:9200/myindex/share/1 respond: { "_index": "myindex", "_type": "share", "_id": "1", "_version": 4, "found": true, "_source": { "url": "www.baidu.com", "place": "Beijing", "company": "Baidu" } }
============================>
linux环境下的安装遇到了几个问题:
首先解压文件:
tar -zxvf elasticsearch-2.3.5.tar.gz
进入目录elasticsearch-2.3.5:
./bin/elasticsearch
但是会报错:
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:270) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Refer to the log for complete error details.
于是,将解压的整个目录更换用户组与用户:
chown -R ccj:ccj elasticsearch-2.3.5
然后切换到该用户:
su - ccj
再开启elasticsearch
[[email protected] elasticsearch-2.3.5]$ ./elasticsearch [2016-08-22 02:11:31,007][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in [2016-08-22 02:11:46,518][INFO ][node ] [Morpheus] version[2.3.5], pid[4098], build[90f439f/2016-07-27T10:36:52Z] [2016-08-22 02:11:46,539][INFO ][node ] [Morpheus] initializing ... [2016-08-22 02:12:20,330][INFO ][plugins ] [Morpheus] modules [lang-groovy, reindex, lang-expression], plugins [], sites [] [2016-08-22 02:12:27,770][INFO ][env ] [Morpheus] using [1] data paths, mounts [[/ (/dev/sda3)]], net usable_space [14.3gb], net total_space [18.2gb], spins? [possibly], types [ext3] [2016-08-22 02:12:27,910][INFO ][env ] [Morpheus] heap size [1007.3mb], compressed ordinary object pointers [true] [2016-08-22 02:12:27,992][WARN ][env ] [Morpheus] max file descriptors [1024] for elasticsearch process likely too low, consider increasing to at least [65536] [2016-08-22 02:16:50,949][INFO ][node ] [Morpheus] initialized [2016-08-22 02:16:51,108][INFO ][node ] [Morpheus] starting ... [2016-08-22 02:21:06,356][WARN ][monitor.jvm ] [Morpheus] [gc][young][3][2] duration [3.8m], collections [1]/[3.9m], total [3.8m]/[4.5m], memory [137.5mb]->[31.4mb]/[1007.3mb], all_pools {[young] [127.7mb]->[7.2mb]/[133.1mb]}{[survivor] [9.7mb]->[16.6mb]/[16.6mb]}{[old] [0b]->[10.1mb]/[857.6mb]} [2016-08-22 02:21:55,549][INFO ][transport ] [Morpheus] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300} [2016-08-22 02:22:05,241][INFO ][discovery ] [Morpheus] elasticsearch/iJG2imH8QrqHjcgqWq0Q1g [2016-08-22 02:22:44,783][WARN ][discovery ] [Morpheus] waited for 30s and no initial state was set by the discovery [2016-08-22 02:23:03,300][INFO ][http ] [Morpheus] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200} [2016-08-22 02:23:05,361][INFO ][node ] [Morpheus] started [2016-08-22 02:23:11,602][INFO ][cluster.service ] [Morpheus] new_master {Morpheus}{iJG2imH8QrqHjcgqWq0Q1g}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received) [2016-08-22 02:23:17,903][INFO ][gateway ] [Morpheus] recovered [0] indices into cluster_state
时间: 2024-11-10 04:51:32