CentOS6.5安裝Elasticsearch

來源:互聯網
上載者:User

CentOS6.5安裝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、wgethttp://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

>>>fromdatetimeimportdatetime

>>> 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'}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.