Teslamate 데이터 backup/restore

2022. 6. 16. 23:05TESLA

데이터 백업

docker-compose exec -T database pg_dump -U teslamate teslamate > /백업받을/경로/teslamate.bck

명령어는 docker-compose.yml 파일이 있는 곳에서 수행

데이터 리스토어

# Stop the teslamate container to avoid write conflicts
docker-compose stop teslamate

# Drop existing data and reinitialize
docker-compose exec -T database psql -U teslamate << .
drop schema public cascade;
create schema public;
create extension cube;
create extension earthdistance;
CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
    RETURNS public.earth
    LANGUAGE SQL
    IMMUTABLE STRICT
    PARALLEL SAFE
    AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
.

# Restore
docker-compose exec -T database psql -U teslamate -d teslamate < /백업받은/파일/teslamate.bck

# Restart the teslamate container
docker-compose start teslamate

참고 : https://docs.teslamate.org/docs/maintenance/backup_restore

'TESLA' 카테고리의 다른 글

원격 센트리캠 접속을 위한 TeslaUSB 구성  (0) 2021.06.30