Class RouterAdminServer
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.hdfs.server.federation.router.RouterAdminServer
- All Implemented Interfaces:
Closeable,AutoCloseable,RouterAdminProtocol,MountTableManager,RouterGenericManager,NameserviceManager,RouterStateManager,org.apache.hadoop.ipc.GenericRefreshProtocol,org.apache.hadoop.ipc.RefreshCallQueueProtocol,org.apache.hadoop.service.Service
public class RouterAdminServer
extends org.apache.hadoop.service.AbstractService
implements RouterAdminProtocol, org.apache.hadoop.ipc.RefreshCallQueueProtocol
This class is responsible for handling all the Admin calls to the HDFS
router. It is created, started, and stopped by
Router.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
Fields inherited from interface org.apache.hadoop.ipc.GenericRefreshProtocol
versionIDFields inherited from interface org.apache.hadoop.ipc.RefreshCallQueueProtocol
versionID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd multiple entries to the mount table.Add an entry to the mount table.Disable a name service.Enable a name service.enterSafeMode(EnterSafeModeRequest request) Enter safe mode and change Router state to RouterServiceState#SAFEMODE.getDestination(GetDestinationRequest request) Get the destination subcluster (namespace) of a file/directory.Get the list of disabled name service.List all mount table entries present at or below the path.static RouterPermissionCheckerGet a new permission checker used for making mount table access control.Get the RPC address of the admin service.getSafeMode(GetSafeModeRequest request) Verify if current Router state is safe mode.static StringGet super group name.static StringGet super user name.leaveSafeMode(LeaveSafeModeRequest request) Leave safe mode and change Router state to RouterServiceState#RUNNING.Collection<org.apache.hadoop.ipc.RefreshResponse>voidRefresh mount table entries cache from the state store.booleanRefresh superuser proxy groups mappings (used in RBF).Remove an entry from the mount table.protected voidserviceInit(org.apache.hadoop.conf.Configuration configuration) protected voidprotected voidUpdates an existing entry in the mount table.Verify the file exists in destination nameservices to avoid dangling mount points.Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
RouterAdminServer
public RouterAdminServer(org.apache.hadoop.conf.Configuration conf, Router router) throws IOException - Throws:
IOException
-
-
Method Details
-
getRpcAddress
Get the RPC address of the admin service.- Returns:
- Administration service RPC address.
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
addMountTableEntry
public AddMountTableEntryResponse addMountTableEntry(AddMountTableEntryRequest request) throws IOException Description copied from interface:MountTableManagerAdd an entry to the mount table.- Specified by:
addMountTableEntryin interfaceMountTableManager- Parameters:
request- Fully populated request object.- Returns:
- True if the mount table entry was successfully committed to the data store.
- Throws:
IOException- Throws exception if the data store is not initialized.
-
addMountTableEntries
public AddMountTableEntriesResponse addMountTableEntries(AddMountTableEntriesRequest request) throws IOException Description copied from interface:MountTableManagerAdd multiple entries to the mount table.- Specified by:
addMountTableEntriesin interfaceMountTableManager- Parameters:
request- Request object with fully populated list of mount point entries.- Returns:
- True if all the mount table entries were successfully committed to the data store.
- Throws:
IOException- Throws exception if the data store is not initialized.
-
updateMountTableEntry
public UpdateMountTableEntryResponse updateMountTableEntry(UpdateMountTableEntryRequest request) throws IOException Description copied from interface:MountTableManagerUpdates an existing entry in the mount table.- Specified by:
updateMountTableEntryin interfaceMountTableManager- Parameters:
request- Fully populated request object.- Returns:
- True if the mount table entry was successfully committed to the data store.
- Throws:
IOException- Throws exception if the data store is not initialized.
-
removeMountTableEntry
public RemoveMountTableEntryResponse removeMountTableEntry(RemoveMountTableEntryRequest request) throws IOException Description copied from interface:MountTableManagerRemove an entry from the mount table.- Specified by:
removeMountTableEntryin interfaceMountTableManager- Parameters:
request- Fully populated request object.- Returns:
- True the mount table entry was removed from the data store.
- Throws:
IOException- Throws exception if the data store is not initialized.
-
getMountTableEntries
public GetMountTableEntriesResponse getMountTableEntries(GetMountTableEntriesRequest request) throws IOException Description copied from interface:MountTableManagerList all mount table entries present at or below the path. Fetches from the state store.- Specified by:
getMountTableEntriesin interfaceMountTableManager- Parameters:
request- Fully populated request object.- Returns:
- List of all mount table entries under the path. Zero-length list if none are found.
- Throws:
IOException- Throws exception if the data store cannot be queried.
-
enterSafeMode
Description copied from interface:RouterStateManagerEnter safe mode and change Router state to RouterServiceState#SAFEMODE.- Specified by:
enterSafeModein interfaceRouterStateManager- Parameters:
request- Request to enter safe mode.- Returns:
- Response to enter safe mode.
- Throws:
IOException- If it cannot perform the operation.
-
leaveSafeMode
Description copied from interface:RouterStateManagerLeave safe mode and change Router state to RouterServiceState#RUNNING.- Specified by:
leaveSafeModein interfaceRouterStateManager- Parameters:
request- Request to leave safe mode.- Returns:
- Response to leave safe mode.
- Throws:
IOException- If it cannot perform the operation.
-
getSafeMode
Description copied from interface:RouterStateManagerVerify if current Router state is safe mode.- Specified by:
getSafeModein interfaceRouterStateManager- Parameters:
request- Request to get the safe mode state.- Returns:
- Response to get the safe mode state.
- Throws:
IOException- If it cannot perform the operation.
-
refreshMountTableEntries
public RefreshMountTableEntriesResponse refreshMountTableEntries(RefreshMountTableEntriesRequest request) throws IOException Description copied from interface:MountTableManagerRefresh mount table entries cache from the state store. Cache is updated periodically but with this API cache can be refreshed immediately. This API is primarily meant to be called from the Admin Server. Admin Server will call this API and refresh mount table cache of all the routers while changing mount table entries.- Specified by:
refreshMountTableEntriesin interfaceMountTableManager- Parameters:
request- Fully populated request object.- Returns:
- True the mount table entry was updated without any error.
- Throws:
IOException- Throws exception if the data store is not initialized.
-
getDestination
Description copied from interface:MountTableManagerGet the destination subcluster (namespace) of a file/directory.- Specified by:
getDestinationin interfaceMountTableManager- Parameters:
request- Fully populated request object including the file to check.- Returns:
- The response including the subcluster where the input file is.
- Throws:
IOException- Throws exception if the data store is not initialized.
-
verifyFileInDestinations
Verify the file exists in destination nameservices to avoid dangling mount points.- Parameters:
entry- the new mount points added, could be from add or update.- Returns:
- destination nameservices where the file doesn't exist.
- Throws:
IOException- unable to verify the file in destinations
-
disableNameservice
public DisableNameserviceResponse disableNameservice(DisableNameserviceRequest request) throws IOException Description copied from interface:NameserviceManagerDisable a name service.- Specified by:
disableNameservicein interfaceNameserviceManager- Parameters:
request- Request to disable a name service.- Returns:
- Response to disable a name service.
- Throws:
IOException- If it cannot perform the operation.
-
enableNameservice
public EnableNameserviceResponse enableNameservice(EnableNameserviceRequest request) throws IOException Description copied from interface:NameserviceManagerEnable a name service.- Specified by:
enableNameservicein interfaceNameserviceManager- Parameters:
request- Request to enable a name service.- Returns:
- Response to disable a name service.
- Throws:
IOException- If it cannot perform the operation.
-
getDisabledNameservices
public GetDisabledNameservicesResponse getDisabledNameservices(GetDisabledNameservicesRequest request) throws IOException Description copied from interface:NameserviceManagerGet the list of disabled name service.- Specified by:
getDisabledNameservicesin interfaceNameserviceManager- Parameters:
request- Request to get the disabled name services.- Returns:
- Response to get the disabled name services.
- Throws:
IOException- If it cannot perform the operation.
-
getPermissionChecker
public static RouterPermissionChecker getPermissionChecker() throws org.apache.hadoop.security.AccessControlExceptionGet a new permission checker used for making mount table access control. This method will be invoked during each RPC call in router admin server.- Returns:
- Router permission checker.
- Throws:
org.apache.hadoop.security.AccessControlException- If the user is not authorized.
-
getSuperUser
Get super user name.- Returns:
- String super user name.
-
getSuperGroup
Get super group name.- Returns:
- String super group name.
-
refresh
- Specified by:
refreshin interfaceorg.apache.hadoop.ipc.GenericRefreshProtocol
-
refreshSuperUserGroupsConfiguration
Description copied from interface:RouterGenericManagerRefresh superuser proxy groups mappings (used in RBF).- Specified by:
refreshSuperUserGroupsConfigurationin interfaceRouterGenericManager- Returns:
- true if the operation was successful.
- Throws:
IOException- if operation was not successful.
-
refreshCallQueue
- Specified by:
refreshCallQueuein interfaceorg.apache.hadoop.ipc.RefreshCallQueueProtocol- Throws:
IOException
-