-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refine the replica-setup-pg and its doc
- Loading branch information
1 parent
fe8bb4d
commit 6391e87
Showing
9 changed files
with
73 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Loading Data from PostgreSQL to MyDuck using pg_dump | ||
|
||
This guide walks you through the process of loading data from an existing PostgreSQL instance to MyDuck Server. | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure that: | ||
|
||
- **MyDuck Server** is installed and running on your server. | ||
- A **pg_dump** file is available. | ||
|
||
## Getting Started | ||
|
||
To let MyDuck Server replicate data from an existing PostgreSQL instance, run the provided `setup.sh` script. | ||
|
||
### Usage | ||
|
||
```bash | ||
bash setup.sh --pg_dump /path/to/pg_dump | ||
``` | ||
|
||
### Parameters | ||
|
||
- **`--pg_dump`**: The path to the PostgreSQL dump file. | ||
- **`--myduck_port`**: The port on which MyDuck Server is listening connections. | ||
|
||
### Example | ||
|
||
```bash | ||
bash setup.sh --pg_dump pg_dump.sql | ||
``` | ||
|
||
This command loads data from the PostgreSQL dump file `pg_dump.sql` into MyDuck Server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# Function to check if a command was successful | ||
check_command() { | ||
if [[ $? -ne 0 ]]; then | ||
echo "Error: $1 failed." | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package pgserver | ||
|
||
import "regexp" | ||
|
||
type QueryModifier func(string) string | ||
|
||
func NewQueryReplacer(regex string, replacement string) QueryModifier { | ||
r := regexp.MustCompile(regex) | ||
return func(query string) string { | ||
return r.ReplaceAllString(query, replacement) | ||
} | ||
|
||
} | ||
|
||
func NewQueryRemover(regex string) QueryModifier { | ||
return NewQueryReplacer(regex, "") | ||
} | ||
|
||
var ( | ||
removeLocaleProvider = NewQueryRemover(`(?i)LOCALE_PROVIDER = [^ ;]*`) | ||
removeLocale = NewQueryRemover(`(?i)LOCALE = [^ ;]*`) | ||
) |