go.dedis.ch/onet/v3@v3.2.11-0.20210930124529-e36530bca7ef/dbadmin/README.md (about) 1 # DB-Admin 2 3 This tool allows you to inspect, split, and merge db-files. 4 It is useful if you have more than one conode, or if you want to migrate only 5 part of the conode's DB over to a new conode. 6 The tool doesn't rely on knowledge of any particular service, but it rather 7 uses the underlying db structure as imposed by onet. 8 9 ## Inspect 10 11 The first thing you can do is to list all data stored in a db in a concise 12 manner: 13 14 ```bash 15 dbadmin inspect xxxx.db 16 ``` 17 18 By default, it prints the list of services stored, and how much space they take. 19 You can get more information by using the `-v` flag: 20 21 ```bash 22 dbadmin inspect -v xxxx.db 23 ``` 24 25 ## Backup service 26 27 You can backup the data of a service like this: 28 29 ```bash 30 dbadmin extract --source xxxx.db --destination backup.db ServiceName.* 31 ``` 32 33 This will output all data of the given service to a file called `backup.db`. 34 The servicename(s) given as arguments can contain regular expressions. 35 A service like `skipchain` has at least 3 buckets: 36 - `Skipchain` 37 - `Skipchain_skipblocks` 38 - `Skipchainversion` 39 40 The `dbadmin` tool doesn't know about any relationship. 41 It is up to the caller to make sure that all buckets are copied correctly. 42 Onet usually puts all databases belonging to a service in buckets that all 43 start with the name of the service, followed by `_` and the name of the 44 additional bucket required by the service. 45 46 ## Restore Service 47 48 Merging a service file into an existing DB copies the data of this 49 service to the destination DB. 50 If the destination DB or the service in the destination DB already exists 51 , the call must include `--overwrite` 52 53 ```bash 54 dbadmin extxract --source backup.db --destination xxxx.db 55 ``` 56 57 This will take all the data stored in `back.db` and use it to 58 overwrite the data of the service in `yyyy.db`. 59 60 ## Copy Service From One Conode to Another 61 62 If you have two conodes with databases `xxxx.db` and `yyyy.db`, you can copy 63 the services from one conode to another with the following command: 64 65 ```bash 66 dbadmin extract --source xxxx.db --destination yyyy.db --overwrite 67 ``` 68 69 This will copy _all_ services from `xxxx.d` to `yyyy.db`. If you only want to 70 copy one service, you can do: 71 72 ```bash 73 dbadmin extract --source xxxx.db --destination yyyy.db --overwrite ServiceName.* 74 ```