diff --git a/README.md b/README.md index 7e9cf26c3a301539bfc20ae461eece36ff1111db..6652da96b49b5b709517799650aec5ad3b58649c 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ duniter4j is a Java Client API for [Duniter](http://duniter.org). duniter4j has four main components : - - shared: common classes + - duniter4j-core-shared: common classes - - core-client: a Client API to access to a Duniter network. + - duniter4j-core-client: a Client API to access to a Duniter network. - - elasticsearch: a ES plugin, to store blockchain, registry, market and more. + - duniter4j-elasticsearch: a ES plugin, to store blockchain, registry, market and more. ## Install as ES plugin @@ -40,11 +40,11 @@ sudo apt-get install openjdk-8-jre Download lastest release of ElasticSearch ### Install ElasticSearch plugins - + ```bash /bin/plugin install mapper-attachments - /bin/plugin install https://github.com/duniter/duniter4j/releases/download/0.2.0/duniter4j-elasticsearch-0.2.0.zip + /bin/plugin install https://github.com/duniter/duniter4j/releases/download/0.3.4/duniter4j-elasticsearch-0.3.4.zip ``` ### Install libsodium @@ -72,7 +72,7 @@ sudo apt-get install openjdk-8-jre - Install Libsodium (see on top) - - Download lastest release of file duniter4j-elasticsearch-X.Y-standalone.zip + - Download [lastest release](https://github.com/duniter/duniter4j/releases) of file duniter4j-elasticsearch-X.Y-standalone.zip - Unzip @@ -140,32 +140,6 @@ $ ./elasticsearch [2016-09-24 00:17:11,026][INFO ][duniter.blockchain ] [test_net] [cgeek.fr:9330] Indexing block #41282 - hash [00000AAD73B0E76B870E6779CD7ACCCE175802D7867C13B5C8ED077F380548C5] ``` -Show help : - -```bash -$ ./elasticseacrh --help -NAME - - start - Start Elasticsearch - -(...) - -OPTIONS - - -h,--help Shows this message - - -p,--pidfile <pidfile> Creates a pid file in the specified path on start - - -d,--daemonize Starts Elasticsearch in the background - - -Dproperty=value Configures an Elasticsearch specific property, like -Dnetwork.host=127.0.0.1 - - --property=value Configures an elasticsearch specific property, like --network.host 127.0.0.1 - --property value - - NOTE: The -d, -p, and -D arguments must appear before any --property arguments. - -``` ## Use API (Developer) @@ -200,20 +174,6 @@ curl -XGET 'http://localhost:9200/test_net/block/_search' -d '{ "_source": ["number", "dividend", "hash", "membersCount"] }' ``` - - - Get blocks from 0 to 100 - -```bash -curl -XGET 'http://localhost:9200/test_net/block/_search' -d '{ - "query": { - "filtered" : { - "filter": { - "exists" : { "field" : "dividend" } - } - } - } -}' -``` More documentation here : diff --git a/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml b/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml index 2e090a7210d96d9c224d9bc974cc7eacb45700b7..bfde540b2c396897a130de459f70d8a50646490b 100644 --- a/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml +++ b/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml @@ -52,15 +52,18 @@ cluster.name: duniter4j-elasticsearch # # Set the bind address to a specific IP (IPv4 or IPv6): # -# network.host: 192.168.0.1 +# network.host: 192.168.233.118 # # Set a custom port for HTTP: # -# http.port: 9200 +# http.port: 9200-9300 http.cors.allow-origin: "/.*/" http.cors.enabled: true +# Internal transport layer +# +# transport.tcp.port: 9210-9220 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html> @@ -129,7 +132,7 @@ duniter.port: 9330 # # Enable security, to disable HTTP access to the default ES admin API # -duniter.security.enable: true +duniter.security.enable: false # # Security token prefix (default: 'duniter-') # diff --git a/duniter4j-elasticsearch/src/test/es-home/config/elasticsearch.yml b/duniter4j-elasticsearch/src/test/es-home/config/elasticsearch.yml index 8f8cfb69d5d39dc062b209b0f7f8de3b08cb317e..a8dc50e68730ec3fcfc31373ed75c801dbfd027e 100644 --- a/duniter4j-elasticsearch/src/test/es-home/config/elasticsearch.yml +++ b/duniter4j-elasticsearch/src/test/es-home/config/elasticsearch.yml @@ -21,7 +21,7 @@ cluster.name: duniter4j-elasticsearch-TEST # # Use a descriptive name for the node: # -node.name: TEST +# node.name: node-1 # # Add custom attributes to the node: # @@ -52,18 +52,18 @@ node.name: TEST # # Set the bind address to a specific IP (IPv4 or IPv6): # -# network.host: 192.168.0.1 -network.host: 192.168.0.28 +# network.host: 192.168.233.1 # # Set a custom port for HTTP: # -# http.port: 9200 - -http.port: 9203 +# http.port: 9200-9300 http.cors.allow-origin: "/.*/" http.cors.enabled: true +# Internal transport layer +# +# transport.tcp.port: 9210-9220 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html> @@ -73,8 +73,8 @@ http.cors.enabled: true # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # -#discovery.zen.ping.unicast.hosts: ["192.168.0.5", "192.168.0.28"] -discovery.zen.ping.unicast.hosts: ["127.0.0.1"] +# discovery.zen.ping.unicast.hosts: ["host1", "host2"] +#discovery.zen.ping.unicast.hosts: ["127.0.0.1", ""] # # Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1): # @@ -100,53 +100,52 @@ discovery.zen.ping.unicast.hosts: ["127.0.0.1"] # # Require explicit names when deleting indices: # -action.destructive_requires_name: true +# action.destructive_requires_name: true security.manager.enabled: false - -#duniter.enabled: true -#duniter.host: cgeek.fr -#duniter.port: 9330 - -duniter.host: 192.168.0.28 -duniter.port: 9604 -#duniter.host: 192.168.0.28 -#duniter.port: 9202 - -changes.listenSource: currency,*/block,*/record - +# +# ---------------------------------- Duniter4j --------------------------------- +# +# Disbale duniter4j plugin +# +# duniter.enabled: false +# +# Reset and reload all Duniter4j data at startup - DO SET to true in production +# +# duniter.indices.reload: true +# +# Default string analyzer +# duniter.string.analyzer: french - -#duniter.indices.reload: true - -# Should synchronize node blockchain ? -#duniter.blockchain.sync.enable: true +# +# Enabling node blockchain synchronization +# duniter.blockchain.sync.enable: true - -duniter.security.enable: true - -# Should synchronize data using P2P -duniter.data.sync.enable: false -duniter.data.sync.host: data.le-sou.org -duniter.data.sync.port: 80 -#TODO duniter.network.timeout: - -# TODO : implement this option (check if same cluster) -#duniter.data.sync.checkClusterName=false - -#duniter.dev.enable: true - -#duniter.keyring.salt: -#duniter.keyring.password: -#duniter.keyring.pub: -#duniter.keyring.sec: - - -#script.groovy.sandbox.enabled: true - +# +# Duniter node to synchronize +# +duniter.host: cgeek.fr +duniter.port: 9330 +# +# ---------------------------------- Duniter4j security ------------------------- +# +# Enable security, to disable HTTP access to the default ES admin API +# +duniter.security.enable: false +# # Security token prefix (default: 'duniter-') -#duniter.auth.token.prefix: duniter- - +# +# duniter.auth.token.prefix: duniter- +# # Token validity duration, in seconds (default: 600) -duniter.auth.tokenValidityDuration: 3600 # = 1hour \ No newline at end of file +# +# duniter.auth.tokenValidityDuration: 3600 # = 1hour +# +# ---------------------------------- Duniter4j P2P sync ------------------------- +# +# Should synchronize data using P2P +# +duniter.data.sync.enable: false +#duniter.data.sync.host: data.duniter.fr +#duniter.data.sync.port: 80 \ No newline at end of file diff --git a/duniter4j-elasticsearch/src/test/resources/curl_test.sh b/duniter4j-elasticsearch/src/test/resources/curl_test.sh index 439133dddc503c201ecfd3bc4a17ed684784880d..4f62377a7b20ee747e1a99f1c6ab627e9caa8b35 100755 --- a/duniter4j-elasticsearch/src/test/resources/curl_test.sh +++ b/duniter4j-elasticsearch/src/test/resources/curl_test.sh @@ -1,26 +1,16 @@ #!/bin/sh -curl -XPOST "http://data.duniter.fr/market/record/_search?pretty&scroll=1m" -d' +curl -XPOST "http://data.duniter.fr/market/comment/_search?pretty" -d' { "query": { - "bool":{ - "should": { - "range":{ - "time":{ - "gte":0 - } - } - }, "filter": [ {"term":{ - "currency":"sou" + "record":"AVbieTIAup9uzWgKipsC" } - } + } ] } - }, - "from":0, - "size":100 + } }'