Skip to content

Commit

Permalink
Add backup influxdb
Browse files Browse the repository at this point in the history
  • Loading branch information
clementpl committed May 18, 2019
1 parent 69da082 commit d06aadf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ package-lock.json
.nyc_output/
.coveralls.yml
log/
mysnapshot/
mysnapshot/
backup/*
2 changes: 2 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
influx:
image: influxdb:alpine
container_name: influxdb
volumes:
- ./data/influxdb:/var/lib/influxdb
ports:
- '8086:8086'
- '8088:8088'
Expand Down
4 changes: 1 addition & 3 deletions docker/influx/init-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ curl -XPOST "http://127.0.0.1:8086/query" --data-urlencode "q=DROP DATABASE \"te
docker exec influxdb influxd restore -portable -db test_crypto_series /testset

# Make backup
# docker run influxdb influxd backup -portable -db test_crypto_series -end 2018-03-15T00:00:00Z -start 2018-02-15T00:00:00Z ./testset
# docker exec influxdb influxd backup -portable -db test_crypto_series -end 2018-03-15T00:00:00Z -start 2018-02-15T00:00:00Z ./testset
# docker cp influxdb:/testset .

# COPY DATA INFLUX (FROM ONE DB TO ANOTHER)
# SELECT * INTO test_crypto_series..OHLC FROM dev_crypto_series..OHLC group by *
# SELECT * INTO test_crypto_series..OHLC_FILLED FROM dev_crypto_series..OHLC_FILLED group by *

# package.json suggest
# "backup-influx": "docker run influxdb influxd backup -portable ./backup/`date +\"%m_%d_%Y\"`",
# "restore-influx": "docker run influxdb influxd restore -portable",

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"prettier": "prettier --write 'src/**/*.ts'",
"docker-start": "docker-compose -f ./docker/docker-compose.yml up -d",
"docker-stop": "docker-compose -f ./docker/docker-compose.yml stop",
"backup-influx": "BKP_PATH=/backup/`date +%Y-%m-%dT%H:%M` && docker exec influxdb influxd backup -portable -db dev_crypto_series $BKP_PATH && docker cp influxdb:${BKP_PATH} .${BKP_PATH}",
"init-influx-test": "bash ./docker/influx/init-test.sh",
"pretest": "node_modules/tslint/bin/tslint --project .",
"start": "ts-node -P ./tsconfig.json src/index.ts"
Expand Down

0 comments on commit d06aadf

Please sign in to comment.