-
Notifications
You must be signed in to change notification settings - Fork 11
PG-1523 Rework uninstallation documentation #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: TDE_REL_17_STABLE
Are you sure you want to change the base?
PG-1523 Rework uninstallation documentation #486
Conversation
e23d3d7
to
feb9ebc
Compare
This commit rearranges the uninstallation documentation and adds instructions for disabling WAL encryption.
feb9ebc
to
c843707
Compare
To uninstall `pg_tde`, follow these steps: | ||
|
||
## 1. Drop the pg_tde extension from all databases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to ## Step 1. Drop the extension from all databases and continue with Step 2... throughout
To uninstall `pg_tde`, follow these steps: | ||
|
||
## 1. Drop the pg_tde extension from all databases | ||
|
||
For all databases where the extensions is loaded you need to follow these steps. This also includes the template databases, in case `pg_tde` was previously enabled there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before uninstalling pg_tde
, you must remove the extension from every database where it is loaded. This includes template databases if pg_tde
was previously enabled there.
@@ -25,6 +26,8 @@ To uninstall `pg_tde`, follow these steps: | |||
DROP EXTENSION pg_tde; | |||
``` | |||
|
|||
If there are any encrypted objects that were not previously decrypted or deleted, this command will fail and you have to follow the step above for these objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!! note
If there are any encrypted objects that were not previously decrypted or deleted, this command will fail and you have to follow the step above for these objects.
## 1. Drop the pg_tde extension from all databases | ||
|
||
For all databases where the extensions is loaded you need to follow these steps. This also includes the template databases, in case `pg_tde` was previously enabled there. | ||
|
||
1. Decrypt or drop encrypted tables: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must clean up all encrypted tables in each database:
-
To decrypt a table, switch it back to the default storage method:
ALTER TABLE <table_name> SET ACCESS METHOD heap;
-
To discard the data**, simply drop the encrypted tables:
DROP TABLE <table_name>;
-
Remove the extension
Once all encrypted tables have been handled, drop the extension from the database:
DROP EXTENSION pg_tde;
|
||
5. Modify the `shared_preload_libraries` and remove the 'pg_tde' from it. Use the `ALTER SYSTEM` command for this purpose, or edit the configuration file. | ||
1. Run `ALTER SYSTEM SET pg_tde.wal_encrypt=off;` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(remove the numbering format)
-
Disable WAL encryption by running:
ALTER SYSTEM SET pg_tde.wal_encrypt=off;
!!! warning | ||
Once `pg_tde` is removed from the `shared_preload_libraries`, reading any leftover encrypted files will fail. Removing the extension from the `shared_preload_libraries` is also possible if the extension is still installed in some databases. | ||
Make sure to do this only if the server has no encrypted files in its data directory. | ||
2. Restart the `postgresql` cluster to apply the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Restart the PostgreSQL cluster to apply the change:
- ....
|
||
```sh | ||
sudo systemctl restart postgresql-17 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing closing ```
!!! note | ||
Encrypted WAL pages will not be decrypted, so any postgres cluster needing to read them will need the `pg_tde` library loaded, and the WAL encryption keys used available. | ||
|
||
At this point, the shared library is still loaded but inactive. Follow these steps to completely uninstall it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, the shared library is still loaded but no longer active. To fully uninstall pg_tde
, complete the steps below.
|
||
postgres=# | ||
``` | ||
2. Remove `pg_tde` from the list and apply the new setting using `ALTER SYSTEM SET shared_preload_libraries=<your list of libraries>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove pg_tde
from the list and apply the new setting using ALTER SYSTEM SET shared_preload_libraries=<your list of libraries>
. For example: ...
At this point, the shared library is still loaded but inactive. Follow these steps to completely uninstall it. | ||
|
||
1. Run `SHOW shared_preload_libraries` to view the current configuration of preloaded libraries. | ||
Example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example: ...
postgres=# ALTER SYSTEM SET shared_preload_libraries=pg_stat_statements,auto_explain; | ||
ALTER SYSTEM | ||
postgres=# | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space needed between ``` and !!!
@@ -57,3 +103,16 @@ To uninstall `pg_tde`, follow these steps: | |||
```sh | |||
sudo systemctl restart postgresql-17 | |||
``` | |||
|
|||
## 4. (optional) Cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Optional) Clean up configuration
|
||
At this point it is safe to remove any configuration related to pg_tde from `postgresql.conf` and `postgresql.auto.conf`. These configuration options have the prefix `pg_tde.` | ||
|
||
## Potential issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit to ## Troubleshooting
with subtopic ### WAL encryption not disabled
@@ -57,3 +103,16 @@ To uninstall `pg_tde`, follow these steps: | |||
```sh | |||
sudo systemctl restart postgresql-17 | |||
``` | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for these last two steps below, please remove the spaces before of the paragraphs completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once all the changes are made, let me have another look just to be safe, thank you very much!
This commit rearranges the uninstallation documentation and adds instructions for disabling WAL encryption.