ALTER SERVER
Function
Adds, modifies, and deletes the definition of a foreign server.
Existing foreign servers can be queried from the pg_foreign_server system catalog.
Precautions
- Only the owner of the server has the permission to run the ALTER SERVER command. System administrators have this permission by default.
- To change the server owner, you must own the foreign server, belong directly or indirectly to the new owner's role, and have the USAGE permission on the server's foreign-data wrapper.
Syntax
- Change the parameters for an external server.
1 2
ALTER SERVER server_name [ VERSION 'new_version' ] [ OPTIONS ( {[ ADD | SET | DROP ] option ['value']} [, ... ] ) ];
- Change the owner of an external server.
1 2
ALTER SERVER server_name OWNER TO new_owner;
- Change the name of an external service.
1 2
ALTER SERVER server_name RENAME TO new_name;
- Refresh the HDFS configuration file.
1
ALTER SERVER server_name REFRESH OPTIONS;
Parameter Description
Parameter |
Description |
Value Range |
---|---|---|
server_name |
Specifies the name of the external service to be modified. |
Name of an existing external server. |
new_version |
Specifies the new version of the external server. |
- |
OPTIONS |
Specifies options for the server. ADD, SET, and DROP specify the operations to be performed. If the OPTIONS option is not specified, the ADD operation is performed by default. Currently, only SET is supported on an HDFS server. ADD and DROP are not supported. The syntax for SET and DROP operations is retained for later use. |
option and value are corresponding operation parameters. For details, see Table 2. |
new_owner |
Specifies the new owner of the external server. |
Valid username. |
new_name |
Specifies the new name of the external server. |
A string compliant with the identifier naming rules. |
REFRESH OPTIONS |
Refreshes the HDFS configuration file cache information. This command is executed when the configuration file changes. If this command is not executed, an access error may occur. This parameter is used to update the HDFS server configuration cache and cannot be concurrently accessed by related HDFS foreign tables. |
- |
Parameter |
Description |
Value Range |
---|---|---|
address |
Specifies the endpoint of the OBS service. Specifies the IP address and port number of the primary and standby nodes of the HDFS cluster.
NOTE:
|
- |
hdfscfgpath |
Specifies the HDFS cluster configuration file.
NOTE:
|
- |
fed |
Indicates that dfs_fdw is connected to HDFS in federation mode. The value rbf indicates that HDFS uses the Router-based Federation (RBF) mode.
NOTE:
This parameter is supported in 8.1.2 or later. In 8.0.0, this parameter is supported only in 8.0.0.10 or later. |
- |
encrypt |
Specifies whether data is encrypted. This parameter is available only when type is OBS. The default value is off. |
|
access_key |
Indicates the access key (AK) (obtained by users from the OBS page) used for the OBS access protocol. When you create a foreign table, its AK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is OBS. |
- |
secret_access_key |
Indicates the secret access key (SK) (obtained by users from the OBS page) used for the OBS access protocol. When you create a foreign table, its SK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is OBS. |
- |
dli_address |
Specifies the endpoint of the DLI service. This parameter is available only when type is DLI. |
- |
dli_access_key |
Specifies the access key (AK) (obtained by users from the DLI console) used for the DLI access protocol. When you create a foreign table, its AK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is DLI. |
- |
dli_secret_access_key |
Specifies the secret access key (SK) (obtained by users from the DLI console) used for the DLI access protocol. When you create a foreign table, its SK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is DLI. |
- |
region |
Indicates the IP address or domain name of the OBS server. This parameter is available only when type is OBS. |
- |
dbname |
Specifies the database name of a remote cluster to be connected. This parameter is used for collaborative analysis and cross-cluster interconnection. |
- |
username |
Specifies the username of a remote cluster to be connected. This parameter is used for collaborative analysis and cross-cluster interconnection. |
- |
password |
Specifies the password of a remote cluster to be connected. This parameter is used for collaborative analysis and cross-cluster interconnection. |
- |
syncsrv |
This parameter is used only for cross-cluster interconnection and indicates the GDS service used during data synchronization. The method for setting this parameter is the same as that for setting the location attribute of the GDS foreign table. This feature is supported only in 8.1.2 or later. |
- |
Examples
Create the hdfs_server external server, in which hdfs_fdw is the built-in foreign data wrapper.
1 2 3 4 5 |
CREATE SERVER hdfs_server FOREIGN DATA WRAPPER HDFS_FDW OPTIONS (address '10.10.0.100:25000,10.10.0.101:25000', hdfscfgpath '/opt/hadoop_client/HDFS/hadoop/etc/hadoop', type 'HDFS' ) ; |
Modify the address option of the external server hdfs_server.
1
|
ALTER SERVER hdfs_server OPTIONS ( SET address '10.10.0.110:25000,10.10.0.120:25000'); |
Modify the hdfscfgpath option of the external server hdfs_server.
1
|
ALTER SERVER hdfs_server OPTIONS ( SET hdfscfgpath '/opt/bigdata/hadoop'); |
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot