While setting path.repo for snapshot facing error

Hi Team,

I have given the backup folder like this in elasticsearch.yml but facing error while restart the elasticsearch , can anyone help me to resolve this issue?

path.repo:["/home/ec2-user/es_backup"]

Caused by: while scanning a simple key
in 'reader', line 38, column 1:
path.repo:["/home/ec2-user/es_ba ...
^
could not find expected ':'
in 'reader', line 39, column 1:
#
^

at org.yaml.snakeyaml.scanner.ScannerImpl.stalePossibleSimpleKeys(ScannerImpl.java:465)
at org.yaml.snakeyaml.scanner.ScannerImpl.needMoreTokens(ScannerImpl.java:280)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:225)
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:558)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:340)

Hi Team,
any update? anyone can help me to resolve this issue?

Thanks,
John D

Can you please show us the full configuration file? Please make sure you format it properly using the available UI tools.

1 Like

I know white spaces can be significant in elasticsearch.yml, so it might be worth trying to add a white space after the colon - like this:

path.repo: ["/home/ec2-user/es_backup"]

and then restart Elasticsearch.

1 Like

hi @Christian_Dahlqvist

this is my configuration file its in aws server

still facing error? can you helpe me to resolve this issue?

======================== Elasticsearch Configuration =========================

NOTE: Elasticsearch comes with reasonable defaults for most settings.

Before you set out to tweak and tune the configuration, make sure you

understand what are you trying to accomplish and the consequences.

The primary way of configuring a node is via this file. This template lists

the most important settings you may want to configure for a production cluster.

Please consult the documentation for further information on configuration options:

https://www.elastic.co/guide/en/elasticsearch/reference/index.html

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

cluster.name: production-prod

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

node.name: ${HOSTNAME}

Add custom attributes to the node:

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

#path.data: /path/to/data

Path to log files:

#path.logs: /path/to/logs

path.repo: ["/home/ec2-user/es_backup"]

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 172.34.12.101

Set a custom port for HTTP:

http.port: 10090

For more information, consult the network module documentation.

--------------------------------- Discovery ----------------------------------

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: ["172.34.12.101","172.34.12.104"]

Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

discovery.zen.minimum_master_nodes: 2

For more information, consult the zen discovery module documentation.

---------------------------------- Gateway -----------------------------------

Block initial recovery after a full cluster restart until N nodes are started:

gateway.recover_after_nodes: 2

For more information, consult the gateway module documentation.

---------------------------------- Various -----------------------------------

Require explicit names when deleting indices:

#action.destructive_requires_name: true

That looks correct to me, but I am wondering if trying to use an environment variable for node.name is allowed and that this might be causing problems. Can you change this to a string and see if that has any effect?

1 Like

Thanks @Christian_Dahlqvist will change and try that one

Hi @Christian_Dahlqvist,
I have changed the node.name in to string
now its facing exception like this , i need to give any permission to this folder?

Caused by: java.nio.file.AccessDeniedException: /home/ec2-user/es_backup
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:1.8.0_161]

The user Elasticsearch is running as need full permissions on that directory.

1 Like

hi @Christian_Dahlqvist,
I used these commands to solve the problem:but facing error?

chmod 777 /home/ec2-user/es_backup , but still facing same error?unable to acess the path.repo

drwxrwxrwx 2 ec2-user ec2-user 4096 Oct 4 07:08 es_backup

-rw-r--r-- 1 root root 9549 Sep 23 2017 README.textile
-rw-r--r-- 1 root root 11358 Sep 23 2017 LICENSE.txt
-rw-r--r-- 1 root root 194187 Sep 23 2017 NOTICE.txt
drwxr-xr-x 2 root root 4096 Sep 23 2017 plugins
drwxr-xr-x 2 root root 4096 Mar 5 2018 bin
drwxr-xr-x 2 root root 4096 Mar 5 2018 lib
drwxr-xr-x 13 root root 4096 Mar 5 2018 modules
lrwxrwxrwx 1 root root 19 Apr 25 11:09 config -> /etc/elasticsearch/
drwxr-xr-x 2 root root 4096 Apr 25 11:10 logs

Exception
Caused by: java.lang.IllegalStateException: Unable to access 'path.repo' (/home/ec2-user/es_backup)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:444) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:326) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:240) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.configure(Security.java:118) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:228) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.2.jar:5.6.2]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /home/ec2-user/es_backup
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:1.8.0_161]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_161]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_161]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:1.8.0_161]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_161]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_161]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_161]
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:486) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.addPath(Security.java:442) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:326) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:240) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Security.configure(Security.java:118) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:228) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.2.jar:5.6.2]

hi @Christian_Dahlqvist,

can you help me to resolve this issue?

It is, I use the same setting - node.name: ${HOSTNAME} - on all my nodes :slight_smile:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.