Data Sync Privilege Planning
When using Tacnode DataSync for data migration and synchronization, permissions for newly migrated data are bound to the task creator. If fine-grained data privilege management is required, you can plan the privilege management model before migration.
Simplified Privilege Model
Simple read-only and write-only privilege management for data.
Creating Read-Only Accounts
Create an account with read-only privileges for all data in the current database:
pg_read_all_data
is a predefined role introduced in PostgreSQL 14+ that grants read access to all tables, views, sequences, and other objects in the database.
Creating Write-Only Accounts
Create an account with write privileges for all data in the current database (note: cannot create tables, views, or other operations):
The pg_write_all_data
role can only perform insert, update, and delete operations on existing tables, but cannot create new tables, views, or other database objects.
Fine-Grained Privilege Management
When read-only and write-only privileges don't meet business requirements, more precise privilege management is needed. You can refer to privilege management best practices to create custom roles and manage related privileges.
Creating Administrator-Level Accounts
Create an account with privileges essentially equivalent to the data owner:
Configuring Default Privileges
Modify the default privileges for objects created by the current user in the future. When objects are created, they will be assigned privileges based on the current user's default configuration:
ALTER DEFAULT PRIVILEGES
only affects newly created objects and does not apply to existing objects. To apply privileges to existing objects, use GRANT ALL ON ALL ...
statements.
DataSync-Specific Privilege Configuration
Data Source Connection Privileges
Minimum privilege requirements for different types of data sources in DataSync:
MySQL Data Sources
PostgreSQL Data Sources
Oracle Data Sources
Target Database Privilege Configuration
In the Tacnode target database, DataSync requires the following privileges:
Privilege Best Practices
1. Principle of Least Privilege
Only grant the minimum set of privileges required for DataSync to complete synchronization tasks:
- Read Privileges: Source database only needs SELECT privileges and necessary metadata access privileges
- Write Privileges: Target database only needs INSERT, UPDATE, DELETE privileges
- DDL Privileges: Only grant CREATE, ALTER privileges when table structure changes need to be synchronized
2. Role Management
Use roles to manage privileges for easier batch authorization and privilege revocation:
3. Network Security
Combine with network access control to restrict the connection sources of DataSync accounts:
4. Privilege Monitoring
Regularly check and audit the privilege usage of DataSync-related accounts:
Troubleshooting
Insufficient Privilege Errors
When encountering insufficient privilege errors, you can troubleshoot using the following methods:
- Check Connection Privileges:
- Check Table Privileges:
- Check Sequence Privileges:
Before using DataSync in production environments, it's recommended to validate privilege configuration in test environments to ensure all synchronization operations can execute normally.
Through proper privilege planning, you can ensure DataSync runs efficiently in a secure environment while meeting enterprise security compliance requirements.