Skip to content

How to enable script.groovy on es 5.0.0 alpha2 for ubuntu Elasticsearch #18297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maksymseleznov opened this issue May 12, 2016 · 9 comments
Closed

Comments

@maksymseleznov
Copy link

maksymseleznov commented May 12, 2016

i added lines to config/elasticsearch.yml

script.groovy: true
script.inline: true
script.indexed: true

restated and got this

 * Stopping Elasticsearch Server                                                                                               [ OK ] 
 * Starting Elasticsearch Server                                                                                               [fail]

i checked log file, it is empty, no errors

can you help me with it

https://discuss.elastic.co/t/how-to-enable-script-groovy-on-es-5-0-0-alpha2-for-ubuntu/49846
https://discuss.elastic.co/t/groovy/49836

@jasontedor
Copy link
Member

Someone from the community should be able to answer your question on Discuss, but Elastic reserves GitHub for verified bug reports and feature requests.

@maksymseleznov
Copy link
Author

but it looks like bug, why log file without error, where i can see why elasticsearch didnt start? @jasontedor

@jasontedor
Copy link
Member

jasontedor commented May 12, 2016

There's no bug here. You're not setting the right settings, and it should be telling you that in the logs:

16:09:11 [jason:~/src/elastic/elasticsearch] master+ 1 ± cat > ~/elasticsearch/elasticsearch-5.0.0-alpha2/config/elasticsearch.yml 
script.groovy: true
script.inline: true
script.indexed: true
16:09:41 [jason:~/src/elastic/elasticsearch] master+ ± ~/elasticsearch/elasticsearch-5.0.0-alpha2/bin/elasticsearch
[2016-05-12 16:09:47,002][INFO ][node                     ] [Lady Lotus] version[5.0.0-alpha2], pid[53827], build[e3126df/2016-04-26T12:08:58.960Z]
[2016-05-12 16:09:47,003][INFO ][node                     ] [Lady Lotus] initializing ...
[2016-05-12 16:09:47,269][INFO ][plugins                  ] [Lady Lotus] modules [lang-mustache, lang-painless, ingest-grok, reindex, lang-expression, lang-groovy], plugins []
[2016-05-12 16:09:47,289][INFO ][env                      ] [Lady Lotus] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [114.3gb], net total_space [232.6gb], spins? [unknown], types [hfs]
[2016-05-12 16:09:47,289][INFO ][env                      ] [Lady Lotus] heap size [989.8mb], compressed ordinary object pointers [true]
Exception in thread "main" java.lang.IllegalArgumentException: unknown setting [script.groovy]
        at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:267)
        at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:238)
        at org.elasticsearch.common.settings.SettingsModule.configure(SettingsModule.java:120)
        at <<<guice>>>
        at org.elasticsearch.node.Node.<init>(Node.java:235)
        at org.elasticsearch.node.Node.<init>(Node.java:161)
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:188)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:188)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:267)
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:111)
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:106)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
        at org.elasticsearch.cli.Command.main(Command.java:53)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:74)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)
Refer to the log for complete error details.

But if I remove the offending settings:

16:10:39 [jason:~/src/elastic/elasticsearch] master+ 130 ± cat > ~/elasticsearch/elasticsearch-5.0.0-alpha2/config/elasticsearch.yml 
script.inline: true
script.stored: true   
16:10:48 [jason:~/src/elastic/elasticsearch] master+ ± ~/elasticsearch/elasticsearch-5.0.0-alpha2/bin/elasticsearch
[2016-05-12 16:10:52,773][INFO ][node                     ] [Ruby Thursday] version[5.0.0-alpha2], pid[54205], build[e3126df/2016-04-26T12:08:58.960Z]
[2016-05-12 16:10:52,773][INFO ][node                     ] [Ruby Thursday] initializing ...
[2016-05-12 16:10:53,044][INFO ][plugins                  ] [Ruby Thursday] modules [lang-mustache, lang-painless, ingest-grok, reindex, lang-expression, lang-groovy], plugins []
[2016-05-12 16:10:53,064][INFO ][env                      ] [Ruby Thursday] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [114.3gb], net total_space [232.6gb], spins? [unknown], types [hfs]
[2016-05-12 16:10:53,064][INFO ][env                      ] [Ruby Thursday] heap size [989.8mb], compressed ordinary object pointers [true]
[2016-05-12 16:10:54,430][INFO ][node                     ] [Ruby Thursday] initialized
[2016-05-12 16:10:54,430][INFO ][node                     ] [Ruby Thursday] starting ...
[2016-05-12 16:10:54,506][INFO ][transport                ] [Ruby Thursday] publish_address {127.0.0.1:9300}, bound_addresses {[fe80::1]:9300}, {[::1]:9300}, {127.0.0.1:9300}
[2016-05-12 16:10:54,510][WARN ][bootstrap                ] [Ruby Thursday] bootstrap checks failed
[2016-05-12 16:10:54,510][WARN ][bootstrap                ] [Ruby Thursday] initial heap size [268435456] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap
[2016-05-12 16:10:54,510][WARN ][bootstrap                ] [Ruby Thursday] please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster.
[2016-05-12 16:10:57,550][INFO ][cluster.service          ] [Ruby Thursday] new_master {Ruby Thursday}{IEy7H74WSYqzukx8oEZaag}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-05-12 16:10:57,569][INFO ][http                     ] [Ruby Thursday] publish_address {127.0.0.1:9200}, bound_addresses {[fe80::1]:9200}, {[::1]:9200}, {127.0.0.1:9200}
[2016-05-12 16:10:57,569][INFO ][node                     ] [Ruby Thursday] started
[2016-05-12 16:10:57,574][INFO ][gateway                  ] [Ruby Thursday] recovered [0] indices into cluster_state

And I can use Groovy against it:

16:12:18 [jason:~] $ curl -XPOST localhost:9200/test/doc/1?pretty=true -d '{"foo": "quick brown fox jumped over the lazy dog", "bar": 1}'
{
  "_index" : "test",
  "_type" : "doc",
  "_id" : "1",
  "_version" : 1,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "created" : true
}
16:12:25 [jason:~] $ curl -XPOST localhost:9200/test/doc/2?pretty=true -d '{"foo": "fast jumping spiders", "bar": 2}'
{
  "_index" : "test",
  "_type" : "doc",
  "_id" : "2",
  "_version" : 1,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "created" : true
}
16:12:45 [jason:~] $ curl -XPOST localhost:9200/test/doc/3?pretty=true -d '{"foo": "dog spiders that can eat a dog", "bar": 3}'
{
  "_index" : "test",
  "_type" : "doc",
  "_id" : "3",
  "_version" : 1,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "created" : true
}
16:13:04 [jason:~] $ curl -XPOST localhost:9200/test/_search?pretty=true -d '
{ "query": {
    "function_score": {
      "query": {
        "match": {
          "foo": "dog"
        }
      },
      "script_score": {
        "script": "_score > 0.0 ? _score : 0"
      }
    }
  }
}'
{
  "took" : 10,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 0.53033006,
    "hits" : [ {
      "_index" : "test",
      "_type" : "doc",
      "_id" : "3",
      "_score" : 0.53033006,
      "_source" : {
        "foo" : "dog spiders that can eat a dog",
        "bar" : 3
      }
    }, {
      "_index" : "test",
      "_type" : "doc",
      "_id" : "1",
      "_score" : 0.3125,
      "_source" : {
        "foo" : "quick brown fox jumped over the lazy dog",
        "bar" : 1
      }
    } ]
  }
}

@maksymseleznov
Copy link
Author

i found problem

i added on the end of file two this lines

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
[__]cluster.name: tapt
#
# ------------------------------------ Other ------------------------------------

script.inline: true
script.stored: true

[__]cluster.name: tapt has two spaces
script.inline: true hasnt space

when i added two spaces for script.inline: true and script.stored: true



# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
[__]cluster.name: tapt
#
# ------------------------------------ Other ------------------------------------

[__]script.inline: true
[__]script.stored: true

[__] - two spaces

elasticsearch started work, thanks for help

@jasontedor
Copy link
Member

Your logs should still be telling you exactly where the problem is:

17:07:19 [jason:~/src/elastic/elasticsearch] master+ 130 ± cat > ~/elasticsearch/elasticsearch-5.0.0-alpha2/config/elasticsearch.yml 
  cluster.name: foo
 node.name: bar 
17:07:40 [jason:~/src/elastic/elasticsearch] master+ ± ~/elasticsearch/elasticsearch-5.0.0-alpha2/bin/elasticsearch
Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ElasticsearchParseException[malformed, expected end of settings but encountered additional content starting at line number: [2], column number: [2]]; nested: ParserException[expected '<document start>', but found BlockMappingStart
 in 'reader', line 2, column 2:
     node.name: bar
     ^
];
Likely root cause: expected '<document start>', but found BlockMappingStart
 in 'reader', line 2, column 2:
     node.name: bar
     ^

        at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
        at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
        at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
        at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:346)
        at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:52)
        at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:77)
        at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:50)
        at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:50)
        at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:948)
        at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:935)
        at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:94)
        at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:202)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:240)
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:111)
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:106)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
        at org.elasticsearch.cli.Command.main(Command.java:53)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:74)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)
Refer to the log for complete error details.

@maksymseleznov
Copy link
Author

maksymseleznov commented May 12, 2016

sorry but it was really empty

Linux ip-10-0-2-253 3.13.0-86-generic #130-Ubuntu SMP Mon Apr 18 18:27:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


apt-get update && apt-get upgrade --quiet --assume-yes  && apt-get dist-upgrade --quiet --assume-yes && apt-get autoremove --quiet --assume-yes && apt-get autoclean

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

java -version

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb http://packages.elastic.co/elasticsearch/5.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-5.x.list

sudo apt-get update && sudo apt-get install elasticsearch

sudo update-rc.d elasticsearch defaults 95 10

service elasticsearch restart  

# uncomment couple lines on /etc/elasticsearch/elasticsearch.yml  replace [#] to [space]

echo "script.inline: true" >> /etc/elasticsearch/elasticsearch.yml
echo "script.stored: true" >> /etc/elasticsearch/elasticsearch.yml

service elasticsearch restart  

and small fix on jvm.options from -Xms256m to -Xms1g

@jasontedor
Copy link
Member

What are you showing here? Those settings are not offending, and anyway the logs do not dump to the console when you start the service. You have to check the actual log files.

@maksymseleznov
Copy link
Author

i showed what i did before checked log file, ok np, now it works, thanks

@jasontedor
Copy link
Member

i showed what i did before checked log file, ok np, now it works, thanks

You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants