This is a QuickStart bundle to help people get started with ElasticSearch global replication with PubNub.
Prerequisites:
- Internet connectivity
- JAVA_HOME and PATH are configured with JDK version 7 or higher
Overall process:
- Request a trial key from PubNub: http://goo.gl/oJnTpv
- Download ElasticSearch PubNub Quickstart bundle:
- Unzip into a local directory
- Configure River or Changes plugin (see below)
- Start ElasticSearch: ./bin/elasticsearch
- edit conf/elasticsearch.yml
pubnub:
enabled:true
publishKey: YOUR-PUBLISH-KEY
subscribeKey: YOUR-SUBSCRIBE-KEY
useSsl:true
channel: elasticsearch_changes
- YOUR-PUBLISH-KEY should match your PubNub publish key
- YOUR-SUBSCRIBE-KEY should match your PubNub subscribe key
- start ElasticSearch
- run the following command using Curl
curl -v -v -XPUT 'localhost:10200/_river/pubnub_river/_meta' -d '{
"type" : "pubnub",
"pubnub" : {
"publishKey" : "YOUR-PUBLISH-KEY",
"subscribeKey" : "YOUR-SUBSCRIBE-KEY",
"useSsl" : "true",
"channels" : "elasticsearch_changes"
},
"index" : {
"bulk_size" : 100
}
}'
The scripts
directory contains two scripts you can use to publish or listen to PubNub.
Prerequisites:
- Install node.js from http://nodejs.org
- Install coffeescript using "npm install -g coffee-script"
- Install PubNub using "npm install -g pubnub"
Using pubnub_debug_listen.coffee:
- edit the script to contain your subscribe key
- run
coffee pubnub_debug_listen.coffee CHANNEL_NAME
, where CHANNEL_NAME is your PubNub channel name (as above, 'elasticsearch_changes')
Using pubnub_debug_publish.coffee:
- edit the script to contain your publish key
- edit the script to reflect your document content, index, key and version
- run
coffee pubnub_debug_publish.coffee CHANNEL_NAME
, where CHANNEL_NAME is your PubNub channel name (as above, 'elasticsearch_changes')