Changing the number of replicas on the flight


According to the elasticsearch documentation, it is possible to change the number of replicas in the open indices. I would like to change the number from 0 to 1 in many of them; currently the new ones have 1 already, as I changed the setting in Graylog’s config.

I tried this kind of a command:

curl -XPUT '{"number_of_replicas": "1"}' http://es01:9200/graylog_69/_settings

and some other variations, but I don’t seem to find the correct command. What would be the correct way to change the setting on-line?

Hey @jtkarvo,

you can use wildcards to select all indices. Try this:

PUT /graylog_*/_settings
  "number_of_replicas": 1

(Exchange “graylog_” with your index name)

Greetings - Phil


thanks for your reply.

It seems my problem was trivial: I forgot “-d” from the command line…

1 Like

Oh, right :smiley:
Just saw that in your post.

Well, have fun with your replicas :slight_smile:

Greetings - Phil

Thanks for you guys’ pointer.

  • I am able to run following command to change the replica from 0 to 1
curl -XPUT -d '{"number_of_replicas": "1"}' http://mysyslog01:9200/graylog_4*/_settings
  • I can see the replica(yellow) got created in Elasticsearch head’s web GUI.


  • After sync , sized doubled from 8/9 to 16/17GB.
 curl -XGET 'mysyslog02:9200/_cat/indices?v&pretty'

health status index       uuid        pri rep docs.count <cut> store.size
green  open   graylog_425 QhH-masked   4   1   43231571  <cut>    17.5gb          8.7gb
green  open   graylog_420 7WlAmasked   4   1   43745655  <cut>    17.2gb          8.6gb
green  open   graylog_418 mOTQmasked   4   1   43885335  <cut>    17.3gb          8.6gb
green  open   graylog_422 oJ8Xmasked   4   1   48102521  <cut>      19gb          9.5gb
green  open   graylog_419 hs3Emasked   4   1   44658968  <cut>    17.5gb          8.7gb
green  open   graylog_421 1XLVmasked   4   1   42517082  <cut>    16.7gb          8.3gb
green  open   graylog_426 tMpHmasked   4   1   37226193  <cut>    16.6gb          8.3gb
green  open   graylog_427 rDJ0masked   4   1   30389074  <cut>    14.5gb          7.3gb
green  open   .kibana     XReomasked   1   1          3  <cut>    24.8kb         12.4kb
green  open   graylog_424 3Yy_masked   4   1   45254311  <cut>    17.9gb          8.9gb
green  open   graylog_423 -KOJmasked   4   1   49306494  <cut>    19.4gb          9.7gb
  • Question is what do I do with repica=0 setting in /etc/graylog/server/server.conf
[root@syslog01 server]# egrep -v '^#|^$'  /etc/graylog/server/server.conf |grep replica
elasticsearch_replicas = 0
[root@syslog01 server]#

If you only have one server, there is no point in having replicas. If you have an elasticsearch cluster, you can have redundancy by setting the number of replicas higher than 0.

@jtkarvo, thanks for reponse.
I have a 4 nodes cluster and I set it replica=1, using curl command above.

I don’t understand the effect of “elasticsearch_replicas = 0” in /etc/graylog/server/server.conf on each node.

Should I change 0 to 1 and reboot each node one at a time ?
What happened if elasticsearch_replicas = 2 only on one node ?

The staff knows better, but my guess would be that the setting in the master node is the one actually used. Namely the master node is the one rotating the index and creating the next index.

you should read the comments in the configuration file @tjyang

The settings in the file are only used once on first startup after that all settings are made online in “System > Indices” in the Graylog web interface.

I feel stupid. I should have remembered that :frowning:

Thanks to @jtkarvo and @jan’s responding.

May I suggest to add following text as ATTENTION line.

# ATTENTION: These settings have been moved to the database in 2.0. When you upgrade, make sure to set these
#            to your previous 1.x settings so they will be migrated to the database!. 
The settings in the file are only used once on first startup after that all settings are made online in “System > Indices” in the Graylog web interface.`

let me know if I need to open up an issue.

feel free to open a PR on github as edit of the example file: