CentOS6.5x86安装Elasticsearch

ElasticSearch是一个基于Lucene构建的开源,分布式,RESTful搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便.

1、  wget http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-i586.rpm?AuthParam=1416296390_276056c6b0870494311edae301500e4f

2、 sudo rpm -ivh jdk-7u71-linux-i586.rpm

3、  which java

4、 vi ~/.bash_profile

export JAVA_HOME=/usr/java/jdk1.7.0_71
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

5、  source ~/.bash_profile && java –version

6、 wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.0.tar.gz 

7、  tar zxf elasticsearch-1.4.0.tar.gz && cd elasticsearch-1.4.0/config

8、  vim elasticsearch.yml

node.name: "hiwechat"

index.number_of_shards: 10

index.number_of_replicas: 1

9、                cd ../bin

10、             ./elasticsearch –d

11、             telnet 127.0.0.1 9300

12、             ./plugin -install medcl/elasticsearch-analysis-ik/1.2.6

13、             cd ../config/

14、             wget http://github.com/downloads/medcl/elasticsearch-analysis-ik/ik.zip

15、             unzip ik.zip

16、             rm -rf ik.zip

other: https://github.com/medcl/elasticsearch-rtf

17、             yum install python-pip

18、             pip install argparse

19、             pip install elasticsearch

20、             curl -X GET localhost:9200

21、             python

 >>> from datetime import datetime

>>> from elasticsearch import Elasticsearch 

# by default we connect to localhost:9200

>>> es = Elasticsearch()

# create an index in elasticsearch, ignore status code 400 (index alreadyexists)

>>> es.indices.create(index='my-index', ignore=400)

{u'acknowledged': True}

# datetimes will be serialized

>>> es.index(index="my-index",doc_type="test-type", id=42, body={"any": "data","timestamp": datetime.now()})

{u'_id': u'42', u'_index': u'my-index', u'_type': u'test-type',u'_version': 1, u'ok': True}

# but not deserialized

>>> es.get(index="my-index",doc_type="test-type", id=42)['_source']

{u'any': u'data', u'timestamp': u'2013-05-12T19:45:31.804229'}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值