|
| 1 | +# Command Reference |
| 2 | + |
| 3 | +Percona Binary Log Server supports the following commands. Use the tables in this section to find a command or argument quickly. |
| 4 | + |
| 5 | +## Commands and arguments |
| 6 | + |
| 7 | +| Command | Arguments | Description | |
| 8 | +|--------|-----------|-------------| |
| 9 | +| `version` | (none) | Prints the semantic version and exits with status 0. | |
| 10 | +| `fetch` | `<json_config_file>` | One-time collection: reads all available binlog events from the source, writes to storage, then exits. | |
| 11 | +| `pull` | `<json_config_file>` | Continuous collection: reads binlog events, waits for more, reconnects as needed, runs until stopped. | |
| 12 | +| `search_by_timestamp` | `<json_config_file>` `<timestamp>` | Returns stored binlog files that contain events with timestamp ≤ the given ISO timestamp. | |
| 13 | +| `search_by_gtid_set` | `<json_config_file>` `<gtid_set>` | Returns the minimal set of stored binlog files that cover the given GTID set (GTID mode only). | |
| 14 | + |
| 15 | +| Argument | Description | |
| 16 | +|----------|-------------| |
| 17 | +| `<json_config_file>` | Path to the JSON configuration file. | |
| 18 | +| `<timestamp>` | ISO timestamp (for example, `2026-02-10T14:30:00`). | |
| 19 | +| `<gtid_set>` | GTID set (for example, `11111111-aaaa-1111-aaaa-111111111111:1:3,22222222-bbbb-2222-bbbb-222222222222:1-6`). | |
| 20 | + |
| 21 | +## Operation modes summary |
| 22 | + |
| 23 | +| Mode | When to use | Behavior | |
| 24 | +|------|-------------|----------| |
| 25 | +| `version` | Check installed version. | Prints version, exits 0. | |
| 26 | +| `fetch` | One-time or on-demand archive. | Connects, reads all current events, writes to storage, exits. Stops on any error. | |
| 27 | +| `pull` | Continuous binlog collection. | Connects, reads events, waits for more; reconnects after timeout or network error. Runs until stopped or fatal error. | |
| 28 | +| `search_by_timestamp` | Find files for point-in-time recovery by time. | Reads metadata, returns list of stored files with events up to the given timestamp. | |
| 29 | +| `search_by_gtid_set` | Find minimal file set for a GTID set. | Reads metadata, returns minimal set of stored files covering the GTID set. Requires GTID-based storage. | |
| 30 | + |
| 31 | +## Command syntax |
| 32 | + |
| 33 | +```bash |
| 34 | +./binlog_server version |
| 35 | +./binlog_server fetch <json_config_file> |
| 36 | +./binlog_server pull <json_config_file> |
| 37 | +./binlog_server search_by_timestamp <json_config_file> <timestamp> |
| 38 | +./binlog_server search_by_gtid_set <json_config_file> <gtid_set> |
| 39 | +``` |
| 40 | + |
| 41 | +## `version` |
| 42 | + |
| 43 | +`version` prints the semantic version embedded in the binary and exits with status code `0`. |
| 44 | + |
| 45 | +Example: |
| 46 | + |
| 47 | +```bash |
| 48 | +./binlog_server version |
| 49 | +``` |
| 50 | + |
| 51 | +Example output: |
| 52 | + |
| 53 | +```text |
| 54 | +0.1.0 |
| 55 | +``` |
| 56 | + |
| 57 | +## `fetch` |
| 58 | + |
| 59 | +`fetch` connects to the remote MySQL server, reads all binary log events currently available on that server, stores the data, then exits. |
| 60 | + |
| 61 | +Use `fetch` when a one-time archive run is needed. |
| 62 | + |
| 63 | +Behavior summary: |
| 64 | + |
| 65 | +* reading existing binary logs from the source server |
| 66 | + |
| 67 | +* exiting after the last available event |
| 68 | + |
| 69 | +* stopping immediately on errors such as network loss or storage failure |
| 70 | + |
| 71 | +## `pull` |
| 72 | + |
| 73 | +`pull` connects to the remote MySQL server, reads binary log events, waits for more events, disconnects after `connection.read_timeout`, sleeps for `replication.idle_time`, then reconnects and continues. |
| 74 | + |
| 75 | +Use `pull` when continuous collection is needed. |
| 76 | + |
| 77 | +Behavior summary: |
| 78 | + |
| 79 | +* following new binary log events over time |
| 80 | + |
| 81 | +* retrying after network-related failures |
| 82 | + |
| 83 | +* stopping on serious failures such as storage problems |
| 84 | + |
| 85 | +## `search_by_timestamp` |
| 86 | + |
| 87 | +`search_by_timestamp` returns the list of saved binary log files that contain at least one event with a timestamp less than or equal to the supplied timestamp. |
| 88 | + |
| 89 | +Example: |
| 90 | + |
| 91 | +```bash |
| 92 | +./binlog_server search_by_timestamp config.json 2026-02-10T14:30:00 |
| 93 | +``` |
| 94 | + |
| 95 | +Example successful output: |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "status": "success", |
| 100 | + "result": [ |
| 101 | + { |
| 102 | + "name": "binlog.000001", |
| 103 | + "size": 134217728, |
| 104 | + "uri": "s3://binsrv-bucket/storage/binlog.000001", |
| 105 | + "min_timestamp": "2026-02-09T17:22:01", |
| 106 | + "max_timestamp": "2026-02-09T17:22:08", |
| 107 | + "initial_gtids": "", |
| 108 | + "added_gtids": "11111111-aaaa-1111-aaaa-111111111111:1-123456" |
| 109 | + }, |
| 110 | + { |
| 111 | + "name": "binlog.000002", |
| 112 | + "size": 134217728, |
| 113 | + "uri": "s3://binsrv-bucket/storage/binlog.000002", |
| 114 | + "min_timestamp": "2026-02-09T17:22:08", |
| 115 | + "max_timestamp": "2026-02-09T17:22:09", |
| 116 | + "initial_gtids": "11111111-aaaa-1111-aaaa-111111111111:1-123456", |
| 117 | + "added_gtids": "11111111-aaaa-1111-aaaa-111111111111:123457-246912" |
| 118 | + } |
| 119 | + ] |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +Possible error messages include: |
| 124 | + |
| 125 | +* `Invalid timestamp format` |
| 126 | + |
| 127 | +* `Binlog storage is empty` |
| 128 | + |
| 129 | +* `Timestamp is too old` |
| 130 | + |
| 131 | +## `search_by_gtid_set` |
| 132 | + |
| 133 | +`search_by_gtid_set` returns the minimum set of saved binary log files required to cover the supplied GTID set. This mode requires storage created with GTID-based replication. |
| 134 | + |
| 135 | +Example: |
| 136 | + |
| 137 | +```bash |
| 138 | +./binlog_server search_by_gtid_set config.json 11111111-aaaa-1111-aaaa-111111111111:10-20 |
| 139 | +``` |
| 140 | + |
| 141 | +Example successful output: |
| 142 | + |
| 143 | +```json |
| 144 | +{ |
| 145 | + "status": "success", |
| 146 | + "result": [ |
| 147 | + { |
| 148 | + "name": "binlog.000001", |
| 149 | + "size": 134217728, |
| 150 | + "uri": "s3://binsrv-bucket/storage/binlog.000001", |
| 151 | + "min_timestamp": "2026-02-09T17:22:01", |
| 152 | + "max_timestamp": "2026-02-09T17:22:08", |
| 153 | + "initial_gtids": "", |
| 154 | + "added_gtids": "11111111-aaaa-1111-aaaa-111111111111:1-123456" |
| 155 | + } |
| 156 | + ] |
| 157 | +} |
| 158 | +``` |
| 159 | + |
| 160 | +Possible error messages include: |
| 161 | + |
| 162 | +* `cannot parse GTID set` |
| 163 | + |
| 164 | +* `Binlog storage is empty` |
| 165 | + |
| 166 | +* `The specified GTID set cannot be covered` |
| 167 | + |
| 168 | +* `GTID set search is not supported in storages created in position-based replication mode` |
0 commit comments