Specify parameters in the format described below.
Custom resource spec | Default | Change effect |
|---|---|---|
spec.targetClusterName | Must specify target FEP Cluster name within namespace mentioned in metadata. | |
spec.targetPgpool2Name | Must specify target FEPPgpool2 name within namespace mentioned in metadata when using pgpool2_restart. | |
spec.fepAction.type | Must specify action type. Supported action types are: | |
spec.fepAction.args | Must specify arguments needed for given action. For details of args corresponding to each action refer to "1.2.10.1 FEPAction Specific Operation Details". | |
spec.fepAction.backupType | full | Options If you specify backup for fepAction.type, the type of backup is used. full : Performs a full backup (backs up the contents of the database cluster). incr : Perform an incremental backup (Back up only the database cluster files that were changed during the last backup migration). |
spec.fepAction.backupRepo | 1 | Options Gets a backup in the specified repository. The range is 1 to 256. |
spec.sysExtraLogging | To turn extra debugging on, set value to true. | |
spec.args.targetReplicationName | Options Specify the replication name to modify. If not specified, attempts will be made to modify all replicas defined in the bidirectional replication definition file. |
After execution of FEPAction CR, status is reflected in fepStatus field that is dynamically inserted in current FEPAction CR as needed.
fepStatus field used for FEPAction CR are described here
fepStatus ( with possible values ) | Remarks |
|---|---|
fepActionStatus: | fepStatus is inserted at the top of FEPAction CR |
fepActionCondition: Success | Failure | This flag is inserted in fepAction CR to reflect success or failure of requested action |
fepActionResult: > | The result contains verbose details corresponding to the specific action been executed. Should be noted that it is either plain text of HTTP output. |
processedTimestamp: <time stamp> | Denotes time of action execution by the Operator |
apiVersion: fep.fujitsu.io/v1 kind: FEPAction fepActionStatus: fepActionCondition: Success metadata: name: new-fep-reload-action namespace: myns spec: fepAction: args: - new-fep-sts-0 - new-fep-sts-1 type: reload sysExtraLogging: false targetClusterName: new-fep
Note
Please do not use the FEPAction to perform a switchover or restart while executing backup. Failed to get the backup.
You must create a new FEPAction custom resource for each operation.
Action type - reload
The reload action will manually reload the FEP database on the targeted FEPCluster.
"reload" action type expects users to specify the name of individual FEP pods that they want to run the database reload operation on. They specify that in the args section under the FEPAction CR spec as below :
spec: fepAction: args: - nf-131851-sts-0 - nf-131851-sts-1 type: reload targetClusterName: nf-131851
Action type - restart
The restart action will manually restart the FEP database on the targeted FEPCluster.
"restart" action type expects users to specify the name of individual FEP pods that they want to run the database restart operation on. They specify that in the args section under the FEPAction CR spec as below:
spec: fepAction: args: - nf-131851-sts-0 - nf-131851-sts-1 type: restart targetClusterName: nf-131851
Action type - pod_restart
The pod_restart action will restart specified list of POD for given target cluster. User can specify key word ‘ALL’ under ‘args’ section to restart all pods in target cluster. Alternatively, user can give the list of pods to be started in target cluster. User should either give ALL or the list of the pods.
This action restarts the replica pods first. Once all replicas have been restarted, it switches over the mastership to one of the replica before restarting old master pod. If it is a single node cluster, master will be restarted in its current state. This action is automatically created to restart pods when image or machine specs are changed for fep or backup container depending on autoPodRestart flag in FEPCluster CR (Refer to "1.2.1 FEPCluster Custom Resource Parameters" for details.):
spec: fepAction: args: - nf-131851-sts-0 - nf-131851-sts-1 type: pod_restart targetClusterName: nf-131851
Action type - list
The list action will return the status of the targeted FEPCluster.
"list" action type expects users to specify just the target cluster name to list the details of the same. Looks like below:
spec: fepAction: type: list targetClusterName: nf-131851
Action type - switchover
The switchover action performs a manually switchover of the current leader/primary database from one pod to another pod of the targeted FEPCluster.
"switchover" action type expects users to specify the name of the target cluster that they want to perform switchover. args section is not required for switchover as FEPAction operator code will internally find it and promote new master. FEPAction CR spec as below:
spec: fepAction: type: switchover targetClusterName: nf-131851
Action type - failover
The failover action performs a manually failover of the current primary database from one pod to another pod of the targeted FEPCluster. The difference between switchover and failover is that, switchover expects the primary database is running at the time whereas failover can force switchover of primary role from a non-responding pod to another pod. Note that failover is a disruptive action and may cause data lost.
"failover" action type expects users to specify the names of the candidate pods that they want to failover to. They specify that in the args section under the FEPAction CR spec as below:
spec: fepAction: args: - nf-131851-sts-1 - nf-131851-sts-2 type: failover targetClusterName: nf-131851
Here, nf-131851-sts-1 and nf-131851-2 are the candidate pods to failover to. In this example, the current primary pod would be nf-131851-sts-0.
Action type - pgpool2_restart
"pgpool2_restart" action type expects users to specify the name of individual FEPPgpool2 resource that they want to restart operation on. They specify that in the targetPgpool2Name section under the FEPAction CR spec as below:
spec: fepAction: type: pgpool2_restart targetPgpool2Name: nf-131851-pgpool2
Action type - backup
The "backup" action performs a backup on the target FEPCluster.
The "backup" action type requires you to specify the type of backup and the repository in which to store the data.
In the fepAction section of the FEPAction custom resource specification, specify the following:.
spec:
targetClusterName: new-fep
fepAction:
type: backup
backupType: full
backupRepo: 1Note
Regardless of how the backup was performed (scheduled or FEPAction), if backups were performed at the same time by the same FEPCluster, subsequent backups will fail.
If the backup repository Retention Option is specified in the FEPCluster custom resource spec.fepChildCrVal.backup.pgbackrestParams, the backup files obtained by the FEPAction are also deleted as specified by the option.
Action type - open_tde_masterkey
The open_tde_masterkey action opens a keystore for a TDE-enabled target cluster.
The "open_tde_masterkey" action type requires the user to specify the name of the target cluster on which the keystore will be opened. The args section is not required.
Specify the following:
spec:
targetClusterName: nf-131851
fepAction:
type: open_tde_masterkeyAction type - create_extension
The create_extension action executes "CREATE EXTENSION" on the target FEPCluster and installs the extension.
In fepAction.args, specify the "extension name, version", "database", "schema", and "apply CASCADE options" to be installed.
Parameters specified by args | Description |
|---|---|
extension | Required Specifies the extension and version to be installed. |
version | Option Specifies the version of the extension to be specified for the VARSION option. |
database | Option Specifies the database to install. If omitted, install in the "postgres" database. |
schema | Option Specifies the schema to be installed, which is specified in the SCHEMA option. |
cascade | Option true or false Enables or disables the CASCADE option for CREATE EXTENSION. |
An example specification is shown below.
spec:
targetClusterName: new-fep
fepAction:
type: create_extension
args:
extension: "vci"
version: "2.0"
database: "mydb"
schema: "public"
cascade: "true"Action type - alter_extension
The alter_extension action executes "ALTER EXTENSION" on the target FEPCluster to change the definition of the extension.
You can execute ALTER EXTENSION on the specified FEPCluster container by applying fepAction.args.version with the version to be updated.
Parameters specified by args | Description |
|---|---|
extension | Required Specifies the installed extensions whose definition you want to change. |
database | Option Specifies the database whose extension you want to change. If omitted it will be installed into the "postgres" database. |
version | Option Specifies the version of the installed extension to update. If omitted, it is updated to the latest version available at the time. |
Here is an example of a FEPAction custom resource that updates the version of pg_stat_statements:. When a custom resource is applied, the version of pg_stat_statements is updated to the specified version.
spec:
targetClusterName: new-fep
fepAction:
type: alter_extension
args:
extension:pg_stat_statements
version:1.8
database:sampleAction type - update_admin_password
The update_admin_password action redefines the password for SUPERUSER "postgres" on the target FEPCluster with a random value.
This action will be executed when the FEPCluster custom resource spec.fepChildCrVal.sysUsers.pgAdminPassword is not defined.
An example specification is shown below.
spec: fepAction: type: update_admin_password targetClusterName: new-fep
Action type - backup_expire
You can run the "pgbackrest expire" command on the FEPPod to remove expired backups.
The "pgbackrest expire" command is normally run automatically upon a successful backup, but it can be run by the user, for example, when the definition of the number of generations to retain for a backup is reduced, and the backup data can be deleted so that the number of retained generations conforms to the changed definition.
If you want to reduce the number of backup retention generations and free up disk space, apply "backup_expire" in the FEPAction after changing the retention setting for backup data under the FEPCluster custom resource fepChildCrVal.backup.pgbackrestParams.
You can specify the repository from which to remove the backup by specifying args.repo.
Parameters specified by args | Description |
|---|---|
repo | Options Specified value: integer Specifies the number of the repository from which to remove the backup. If omitted, delete the backup for all backup repositories. |
Note
The number of the backup repository must be N for repoN-type, as defined in the FEPCluster custom resource spec.fepChildCrVal.backup.pgbackrestParams.
The following is an example of changing the retention setting for backup data in a FEPCluster custom resource.
You want to reduce the number of backup generations stored in S3.
spec:
fepChildCrVal:
backup:
pgbackrestParams:
repo2-type=s3
repo2-retention-full=5 # Change it to the number of generations you want to keep
repo2-retention-full-type=timeThe following is an example of a FEPAction custom resource that reduces the number of backup generations:
Since the backup repository for s3 is specified as repo2-type in pgbackrestParams, specify 2 for spec.fepActoin.repo.
apiVersion: fep.fujitsu.io/v1
kind: FEPAction
metadata:
name: backup-expire-action
spec:
targetCluster: new-fep
fepAction:
type: backup_expire
args:
repo: 2Action type - promote_standby
promote_standby promotes the FEP database in the disaster recovery environment from Standby DB to Primary DB. You must specify the DB cluster to be promoted.
The following shows a specification example.
spec:
fepAction:
type: promote_standby
targetClusterName: my-fepAction type - update_multi_master_replication
The update_multi_master_replication action updates the bidirectional replication definition according to changes in the bidirectional replication definition specified in the ConfigMap referenced by the spec.fep.multiMasterReplication.configMapName field of the target FEPCluster custom resource.
Action type - fixed_stats
The fixed_stats action performs a statistics operation (pg_dbms_stats) on the target FEPCluster.
The fixed_stats action must specify the operations that can be performed by pg_dbms_stats. Specify fixedStatsType: < operation type > in spec.fepAction.args. Depending on the operation type, there are additional required and optional arguments. Refer to the table below.
Operation Type | Required Arguments | Optional Argument |
|---|---|---|
backup | None | targetDb: Target database |
restore | targetDb: Target database
| Only when timestamp is defined can a post-schema object be specified. Example)Target specific columns fiexdObject: myschema.mytable.myclomun |
purge | backupId: Backup ID | You can specify a delete flag. |
lock | targetDb: Target data base | fixedObject: Name of the object after the schema |
unlock | targetDb: Target data base | fixedObject: Name of the object after the schema |
cleanup | targetDb: Target data base | None |
import | targetDb: Target data base | fixedObject: Name of the object after the schema |
export | targetDb: Target data base targetStats: Valid and regular statistics | fixedObject: Name of the object after the schema |
Protocol | Required Arguments | Description |
|---|---|---|
s3, gcs | url | URL of object storage |
blob | azureBlobName | BLOB name of the statistics binary file |
azureContainerName | Container name of the Azure storage account | |
local | file | Specify the name of the file to which statistics will be exported/imported. |
The following shows a specification example.
apiVersion: fep.fujitsu.io/v1
kind: FEPAction
metadata:
name: fep-action-firxdStats
spec:
fepAction:
targetClusterName: new-fep
type: fixed_stats
args:
fixedStatsType: backup
targetDb: mydb
fixedObject: schema.table.attaname
comment: "xxyyzz"