您的位置:首页 > 其它

elasticsearch 安装试用跳坑

2016-03-14 14:25 507 查看
上周还在docker的坑里面挣扎,这周又掉到了 es的坑中。

首先我去下载了 最新的版的es (Elasticsearch 2.2)     链接:http://pan.baidu.com/s/1eRzc0vw 密码:c8aa

项目打算是使用 python ,所以用 pip install pyes  安装了操作api的方法  得到的是 pyes==0.99.6

from pyes import ES

host_port = "localhost:9200"
index = "test"
index_type = "test_type"
conn = ES([host_port], timeout=50)  # 连接es
conn.indices.create_index_if_missing(index)  # 创建索引
conn.default_indices = [index]  # 设置默认的索引


然后这么使用, 创建索引 这步都过不了

查了一下    https://pypi.python.org/pypi/pyes/

This version requires elasticsearch 1.x or above. It’s a pre release for pyes 1.x. Give a look to migrations documentation to upgrade you code for ElasticSearch 1.x.


好吧 版本问题。

又下载了  Elasticsearch 1.6.2  链接:http://pan.baidu.com/s/1i4skLSh 密码:9x6h

创建索引这步顺利通过。

但是添加数据报错

No handlers could be found for logger "pyes"
Exception ReferenceError: 'weakly-referenced object no longer exists' in <bound method ES.__del__ of <pyes.es.ES object at 0x0000000002BD4F28>> ignored


不解,我并没有使用 logger什么的

再次下载更低版本 Elasticsearch 1.6.0   链接:http://pan.baidu.com/s/1mhdlFC0 密码:sm1n

这次所有代码通过, 索引创建成功,插入数据成功。

最后说一下 安装 es的 head插件问题

这个方法一般情况都是能行的

1、windows 下再  bin目录 cmd运行  plugin -install mobz/elasticsearch-head

 备用方案

2、
https://github.com/mobz/elasticsearch-head下载zip 解压

建立elasticsearch-1.x.x\plugins\head\_site文件

将解压后的elasticsearch-head-master文件夹下的文件copy到_site

因为我有好几个版本的es,我直接把 2.2里面的 _site 复制到 1.6.2 和 1.6.0 就可以直接使用了  23333333

参考:
http://www.oschina.net/translate/elasticsearch-getting-started?cmp http://blog.csdn.net/july_2/article/details/24481935 http://www.cnblogs.com/zhangchenliang/p/4186702.html http://blog.csdn.net/lvhong84/article/details/23936697
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  es elasticsearch