备份:
数据库备份:
https://help.tableau.com/current/server-linux/zh-cn/cli_maintenance_tsm.htm#tsm
https://help.tableau.com/current/server-linux/zh-cn/backup_restore.htm
更改默认备份路径方法:
https://help.tableau.com/current/server-linux/zh-cn/cli_default_filepaths_tsm.htm
1/ 数据库文件备份
默认位置:
/var/opt/tableau/tableau_server/data/tabsvc/files/backups
获取当前数据库备份位置:
tsm configuration get -k basefilepath.backuprestore
改默认路径
tsm configuration set -k basefilepath.backuprestore -v /data/tableau_backup
tsm pending-changes apply #会重启服务
#再获全备份默认路径,发现已变为
tsm configuration get -k basefilepath.backuprestore
/data/tableau_backup
chgrp tableau /data/tableau_backup
chmod g+rx /data/tableau_backup
#不行就chmod 777 /data/tableau_backup
测试
https://help.tableau.com/current/server-linux/zh-cn/cli_maintenance_tsm.htm#tsm
tsm maintenance backup -f ts_backup -d
检查是否备份到新位置
[tableau_backup]# ls
ts_backup-2019-09-19.tsbak
备份脚本:
#数据库备份
vim /hongfeng/script/postgresql_backup.sh
tsm maintenance backup -f ts_backup -d
#配置备份:
vim /hongfeng/script/config_backup.sh
00 00 * * * /bin/sh /hongfeng/script/postgresql_backup.sh >/dev/null 2>&1
#配置备份:
vim /hongfeng/script/config_backup.sh
#! /bin/sh
date=$(date +%Y_%m_%d)
tsm settings export --output-config-file /data/tableau_backup/config_backup${date}.json
00 01 * * * /bin/sh /hongfeng/script/config_backup.sh >/dev/null 2>&1
#在备份服务器上做个定时删除:
00 02 * * * /bin/sh /hongfeng/script/del_postgresql_backup_db.sh >/dev/null 2>&1
vim /hongfeng/script/del_postgresql_backup_db.sh
find /data/tableau_backup -mtime +7 -name "ts_backup*.tsbak" -exec -Rf {} ;
sleep 10
find /data/tableau_backup -mtime +7 -name "*.json" -exec -Rf {} ;
清理也可用这种方式:
tsm maintenance cleanup -l --log-files-retention 2
2/ 配置和拓扑数据的备份: (上面脚本也包含了)
https://help.tableau.com/current/server-linux/zh-cn/cli_settings_tsm.htm#TSMExport
加个日期变量:
tsm settings export --output-config-file ./backup.json