Elasticsearch 1.7.1 not creating a snapshot, but not reporting error either - elasticsearch

I'm trying to create a snapshot of all indexes in my local Elasticsearch instance.
I've set path.repo as follows in elasticsearch.yml:
path.repo: ["F:\\backup\\elasticsearch"]
And here's the command I'm using to create the snapshot:
curl -XPUT http://localhost:9200/_snapshot/my_test_backup -d '
{
"type": "fs",
"settings": {
"location": "F:\\backup\\elasticsearch\\my_test_backup"
}
}'
Executing this generates the following output from Elasticsearch:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 136 100 21 100 115 269 1474 --:--:-- --:--:-- --:--:-- 1854{"acknowledged":true}
Note, no error.
There are a couple of indexes set up on my local instance, which aren't particularly large so, when I check the snapshot status, it shows no in progress snapshots:
$ curl -XGET http://localhost:9200/_snapshot/_status
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16 100 16 0 0 1000 0 --:--:-- --:--:-- --:--:-- 1000{"snapshots":[]}
As I say, this isn't necessarily a worry because the snapshot would be small anyway. I can see the snapshot I've just created by executing the following, but it appears to have hung:
$ curl -XGET http://localhost:9200/_snapshot
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 100 100 100 0 0 100 0 0:00:01 --:--:-- 0:00:01 97k{"my_test_backup":{"type":"fs","settings":{"location":"F:\\backup\\elasticsearch\\my_test_backup"}}}
Consistent with this, when I navigate to F:\backup\elasticsearch\my_test_backup the folder is empty.
Could somebody tell me why my snapshot isn't working? What am I doing wrong?
Many thanks,
Bart

All you have done there is to create a repository, not a snapshot. Creating a repository is a necessary artifact that will store all future snapshots you will create.
So now that you have your repository, you can simply kick off the snapshot creation as follows:
curl -XPUT "localhost:9200/_snapshot/my_test_backup/snapshot_1"
If you run the following command instead, it will only return when the snapshot is done:
curl -XPUT "localhost:9200/_snapshot/my_test_backup/snapshot_1?wait_for_completion=true"

Related

How do I fix error in installation of repoportal?

I get an error when install repoportal. First I download the components:
Steins-MacBook-Air:ATM steinkorsveien$ curl https://raw.githubusercontent.com/reportportal/reportportal/master/docker-compose.yml -o docker-compose.yml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6907 100 6907 0 0 12512 0 --:--:-- --:--:-- --:--:-- 12581
Steins-MacBook-Air:ATM steinkorsveien$ docker-compose up
Creating network "atm_default" with the default driver
Creating atm_ui_1 ... done
Creating atm_gateway_1 ... done
Creating atm_uat_1 ... done
Creating atm_postgres_1 ... done
Creating atm_minio_1 ... done
Creating atm_elasticsearch_1 ... done
Creating atm_rabbitmq_1 ... done
Creating atm_analyzer_1 ... done
Creating atm_index_1 ... done
Creating atm_db-scripts_1 ... done
ERROR: for api Container "46cb34fca7b4" is unhealthy.
ERROR: Encountered errors while bringing up the project.
How do I fix this error?

Piping raw code from github to ruby not working?

I am doing some basic piping of some simple raw code from github to terminal as shown here i.e.
curl https://raw.github.com/leachim6/hello-world/master/r/ruby.rb | ruby
When I try it, it doesn't produce "Hello World", but instead I just see
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
use
curl -sSL https://raw.github.com/leachim6/hello-world/master/r/ruby.rb | ruby
this should work
Update to explain
this URL is redirecting to
https://raw.githubusercontent.com/leachim6/hello-world/master/r/ruby.rb
so -L option was required to follow the redirection (-L, --location)
this option will make curl redo the request on the new place
sS to hide the progress bar and show errors if happened
to debug curl request you can use -v option which will make you see exactly what is happening

Calling curl command from Ruby's system method

I'm using curl command inside logstash exec plugin to post a message to a stride group. The plugin documentation stated that they were using ruby system method to execute the command, so I'm trying to run it in my ruby IRB.
Escaping the double quotes with backslash character is giving error The request body cannot be parsed as valid JSON. Here is the full error
irb(main):050:0' --inf-ruby-2f3827a9-23243-13517-726000--
curl: (6) Couldn't resolve host 'first'
curl: (3) [globbing] unmatched close brace/bracket in column 9
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 165 0 87 100 78 60 54 0:00:01 0:00:01 --:--:-- 60
{
"statusCode": 400,
"message": "The request body cannot be parsed as valid JSON"
}=> true
I tried swapping double quotes with single quotes and using full double quotes everywhere. Nothing is working.
system("curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer blah-blah' -d '{\"body\":{\"version\":1,\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"My first message!\"}]}]}}' --url 'https://api.atlassian.com/site/blah-blah/conversation/blah-blah/message'")
Is there any way to make this work?
EDIT: I have tried running the cURL command in the terminal and it is working fine.
Besides the following answers on StackOverflow, NetHTTP has notoriously poor documentation but can be used to post what you're interested in.

How do I download a file to a newly created directory with curl on OS X?

I am trying to download my Heroku backups to a folder.
Downloading to the current folder like this works:
curl -o latest.dump `heroku pg:backups public-url`
But when I tried adding a folders path to latest.dump it looks like this:
$ curl -o /db-bkups/latest.dump `heroku pg:backups public-url`
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 44318 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0Warning: Failed to create the file
Warning: /db-bkups/latest.dump: No such file
Warning: or directory
36 44318 36 16384 0 0 9626 0 0:00:04 0:00:01 0:00:03 9626
curl: (23) Failed writing body (0 != 16384)
Ideally, I would like it be saved and downloaded like this:
/db-bkups/nov-1-2016/timestamp-db.dump
Where the folder nov-1-2016 is created dynamically when the cron is run, and the filename is the timestamp when the bkup was run.
You could try using the --create-dirs argument which was added in curl 7.10.3:
Here is an example that will create the directory hierarchy, (if it doesn't already exist), and will name the subdirectory you require renamed with the output of the datecommand:
curl -o /db-bkups/$(date +"%b-%d-%Y")/timestamp-db.dump --create-dirs http://www.w3schools.com/xml/simple.xml
The result is a file stored in a directory like so /db-bkups/Nov-04-2016/timestamp-db.dump.

executing .sh file - "./gradlew no such file or directory" and misc errors

I'm trying to run a .sh file on Windows. More exactly I'm trying to run the build scripts in the following GitHub repo: https://github.com/facebook/facebook-sdk-for-unity.
But I'm extremely novice when it comes to .sh files. And came as far as executing the file by writing the following in "Git Shell": sh ./setup.sh.
I'm unsure which errors is actually "errors", but I've bolded what I think is the important issue. It's also worth mentioning that I've downloaded Gradle 3.1 and added it to my path variable. gradle -v does work (in cmd), but gradlew as a command does not. What am I missing? I feel stupid. :/
I get the following output/errors:
D:\GitHub\facebook-sdk-for-unity [tmp-test-bashscripts]> sh .\scripts\setup.sh
/d/GitHub/facebook-sdk-for-unity/scripts/local.properties: line 1: sdk.dir=D:\Android\android-sdk\sdk: No such file or directory
sed: can't read /FacebookSdkVersion.cs: No such file or directory
.\scripts\setup.sh: line 25: buildAndCopyCore: command not found
.\scripts\setup.sh: line 26: buildAndCopyPlatformDLLs: command not found
/d/GitHub/facebook-sdk-for-unity/scripts/local.properties: line 1: sdk.dir=D:\Android\android-sdk\sdk: No such file or directory
sed: can't read /FacebookSdkVersion.cs: No such file or directory
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 75.1M 100 75.1M 0 0 359k 0 0:03:33 0:03:33 --:--:-- 372k
**/d/GitHub/facebook-sdk-for-unity/scripts/local.properties: line 1: sdk.dir=D:\Android\android-sdk\sdk: No such file or directory**
sed: can't read /FacebookSdkVersion.cs: No such file or directory
\033[0;36mStarting build \033[0m
\033[0;36mStep 1 - Cleaning wrapper libs folder \033[0m
/d/GitHub/facebook-sdk-for-unity/facebook-android-wrapper/libs /d/GitHub/facebook-sdk-for-unity
find: warning: you have specified the -maxdepth option after a non-option argument !, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
/d/GitHub/facebook-sdk-for-unity
\033[0;36mStep 2 - Get depenancies for android wrapper \033[0m
\033[0;36mStep 2.1.0 - Download bolts-android-1.4.0.jar \033[0m
\033[0;36mbolts-android-1.4.0.jar already exists. Skipping download. \033[0m
\033[0;36mStep 2.1.1 - Download bolts-tasks-1.4.0.jar \033[0m
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 546 0 --:--:-- --:--:-- --:--:-- 642
100 190 100 190 0 0 212 0 --:--:-- --:--:-- --:--:-- 690
100 38092 100 38092 0 0 28892 0 0:00:01 0:00:01 --:--:-- 28892
\033[0;36mStep 2.1.2 - Download bolts-applinks-1.4.0.jar \033[0m
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 650 0 --:--:-- --:--:-- --:--:-- 661
100 196 100 196 0 0 233 0 --:--:-- --:--:-- --:--:-- 233
100 25020 100 25020 0 0 20337 0 0:00:01 0:00:01 --:--:-- 228k
\033[0;36mStep 2.2 - Download facebook-android-sdk-4.14.0.aar \033[0m
\033[0;36mfacebook-android-sdk-4.14.0.aar already exists. Skipping download \033[0m
\033[0;36mStep 2.3 - Coping support lib \033[0m
\033[0;36mStep 3 - Build android wrapper \033[0m
/d/GitHub/facebook-sdk-for-unity/facebook-android-wrapper /d/GitHub/facebook-sdk-for-unity
**/d/GitHub/facebook-sdk-for-unity/scripts/setup_android_unity_plugin.sh: line 118: ./gradlew: No such file or directory**
\033[0;31mFATAL: Failed to perform gradle clean \033[0m
\033[0;31mFATAL: Failed to build the android sdk plugin \033[0m
It looks like you are running sh .\scripts\setup.sh in a cmd or Git CMD window. Open a Git Bash window instead. It's important to see "Bash" in its name. In that shell, go to the project directory with the cd command, and run sh ./setup.sh as it was written in the documentation.

Resources