public interface Host extends Comparable
Modifier and Type | Method and Description |
---|---|
boolean |
addDesiredConfig(long clusterId,
boolean selected,
String user,
Config config)
Adds a desired configuration to the host instance.
|
void |
calculateHostStatus(Long clusterId) |
HostResponse |
convertToResponse() |
AgentVersion |
getAgentVersion()
Version of the Ambari Agent running on the host
|
AgentVersion |
getAgentVersion(HostStateEntity hostStateEntity)
Gets version of the ambari agent running on the host.
|
List<HostVersionEntity> |
getAllHostVersions()
Get all of the HostVersionEntity objects for the host.
|
long |
getAvailableMemBytes()
Get the Amount of available memory for the Host.
|
int |
getCpuCount() |
Integer |
getCurrentPingPort() |
Map<String,DesiredConfig> |
getDesiredConfigs(long clusterId)
Gets all the selected configurations for the host.
|
Map<String,HostConfig> |
getDesiredHostConfigs(Cluster cluster,
Map<String,DesiredConfig> clusterDesiredConfigs)
Get the desired configurations for the host including overrides
|
List<DiskInfo> |
getDisksInfo()
Get information on disks available on the host.
|
HostHealthStatus |
getHealthStatus() |
HostHealthStatus |
getHealthStatus(HostStateEntity hostStateEntity)
Gets the health status from host attributes
|
Map<String,String> |
getHostAttributes()
Get additional host attributes
For example, public/hostname/IP for AWS
|
Map<String,String> |
getHostAttributes(HostEntity hostEntity)
Gets host attributes from host entity
|
HostEntity |
getHostEntity() |
Long |
getHostId() |
String |
getHostName() |
String |
getIPv4()
IPv4 assigned to the Host
|
String |
getIPv6()
IPv6 assigned to the Host
|
AgentEnv |
getLastAgentEnv()
Gets the latest agent environment that arrived in a heartbeat.
|
long |
getLastAgentStartTime()
Time the Ambari Agent was started.
|
long |
getLastHeartbeatTime()
Last time the Ambari Server received a heartbeat from the Host
( Unix timestamp )
|
long |
getLastRegistrationTime()
Last time the host registered with the Ambari Server
( Unix timestamp )
|
MaintenanceState |
getMaintenanceState(long clusterId) |
String |
getOsArch()
Get the OS Architecture.
|
String |
getOsFamily()
Get the os Family:
redhat6: for centos6, rhel6, oraclelinux6 ..
|
String |
getOsFamily(Map<String,String> hostAttributes)
Gets the os family from host attributes
|
String |
getOSFamilyFromHostAttributes(Map<String,String> hostAttributes) |
String |
getOsInfo()
Get the General OS information.
|
String |
getOsType()
Get the OS Type: RHEL6/CentOS6/...
|
int |
getPhCpuCount() |
String |
getPrefix()
Get the prefix path of all logs
|
String |
getPublicHostName()
Sets the public-facing host name.
|
String |
getRackInfo() |
RecoveryReport |
getRecoveryReport()
Get detailed recovery report for the host
|
HostState |
getState()
Get Current Host State
|
String |
getStatus()
Get Current Host Status
|
long |
getTimeInState()
Get time spent in the current state i.e.
|
long |
getTotalMemBytes()
Get the Amount of physical memory for the Host.
|
void |
handleEvent(HostEvent event)
Send an event to the Host's StateMachine
|
boolean |
hasComponentsAdvertisingVersions(StackId stackId)
Gets whether this host has components which advertise their version.
|
void |
importHostInfo(HostInfo hostInfo) |
boolean |
isRepositoryVersionCorrect(RepositoryVersionEntity repositoryVersion)
Gets whether all host components whose desired repository version matches
the repository version specified have reported the correct version and are
no longer upgrading.
|
void |
setAgentVersion(AgentVersion agentVersion) |
void |
setAvailableMemBytes(long availableMemBytes)
Set the Amount of available memory for the Host.
|
void |
setCpuCount(int cpuCount) |
void |
setCurrentPingPort(Integer currentPingPort) |
void |
setDisksInfo(List<DiskInfo> disksInfo) |
void |
setHealthStatus(HostHealthStatus healthStatus) |
void |
setHostAttributes(Map<String,String> hostAttributes) |
void |
setIPv4(String ip) |
void |
setIPv6(String ip) |
void |
setLastAgentEnv(AgentEnv env)
Sets the latest agent environment that arrived in a heartbeat.
|
void |
setLastAgentStartTime(long lastAgentStartTime) |
void |
setLastHeartbeatTime(long lastHeartbeatTime) |
void |
setLastRegistrationTime(long lastRegistrationTime) |
void |
setMaintenanceState(long clusterId,
MaintenanceState state)
Sets the maintenance state for the host.
|
void |
setOsArch(String osArch) |
void |
setOsInfo(String osInfo) |
void |
setOsType(String osType) |
void |
setPhCpuCount(int phCpuCount) |
void |
setPrefix(String prefix)
Set the prefix path of all logs of the host
|
void |
setPublicHostName(String hostName)
Gets the public-facing host name.
|
void |
setRackInfo(String rackInfo) |
void |
setRecoveryReport(RecoveryReport recoveryReport)
Set detailed recovery report for the host
|
void |
setState(HostState state)
Set the State of the Host
|
void |
setStateMachineState(HostState state)
Set state of host's state machine.
|
void |
setStatus(String status)
Set the Status of the Host
|
void |
setTimeInState(long timeInState) |
void |
setTotalMemBytes(long totalMemBytes)
Set the Amount of physical memory for the Host.
|
compareTo
HostEntity getHostEntity()
String getHostName()
Long getHostId()
Integer getCurrentPingPort()
void setCurrentPingPort(Integer currentPingPort)
currentPingPort
- the currentPingPort to setvoid setPublicHostName(String hostName)
String getPublicHostName()
String getIPv4()
void setIPv4(String ip)
ip
- the ip to setString getIPv6()
void setIPv6(String ip)
ip
- the ip to setint getCpuCount()
void setCpuCount(int cpuCount)
cpuCount
- the cpuCount to setint getPhCpuCount()
void setPhCpuCount(int phCpuCount)
phCpuCount
- the physical cpu cores to setlong getTotalMemBytes()
void setTotalMemBytes(long totalMemBytes)
totalMemBytes
- the totalMemBytes to setlong getAvailableMemBytes()
void setAvailableMemBytes(long availableMemBytes)
availableMemBytes
- the availableMemBytes to setString getOsArch()
void setOsArch(String osArch)
osArch
- the osArch to setString getOsInfo()
void setOsInfo(String osInfo)
osInfo
- the osInfo to setString getOsType()
String getOsFamily()
String getOsFamily(Map<String,String> hostAttributes)
hostAttributes
- host attributesString getOSFamilyFromHostAttributes(Map<String,String> hostAttributes)
void setOsType(String osType)
osType
- the osType to setList<DiskInfo> getDisksInfo()
void setDisksInfo(List<DiskInfo> disksInfo)
disksInfo
- the disksInfo to setHostHealthStatus getHealthStatus()
HostHealthStatus getHealthStatus(HostStateEntity hostStateEntity)
hostStateEntity
- host attributesRecoveryReport getRecoveryReport()
void setRecoveryReport(RecoveryReport recoveryReport)
void setHealthStatus(HostHealthStatus healthStatus)
healthStatus
- the healthStatus to setMap<String,String> getHostAttributes()
Map<String,String> getHostAttributes(HostEntity hostEntity)
hostEntity
- host entityvoid setHostAttributes(Map<String,String> hostAttributes)
hostAttributes
- the hostAttributes to setString getRackInfo()
void setRackInfo(String rackInfo)
rackInfo
- the rackInfo to setlong getLastRegistrationTime()
void setLastRegistrationTime(long lastRegistrationTime)
lastRegistrationTime
- the lastRegistrationTime to setlong getLastAgentStartTime()
void setLastAgentStartTime(long lastAgentStartTime)
lastAgentStartTime
- the lastAgentStartTime to setlong getLastHeartbeatTime()
void setLastHeartbeatTime(long lastHeartbeatTime)
lastHeartbeatTime
- the lastHeartbeatTime to setvoid setLastAgentEnv(AgentEnv env)
AgentEnv getLastAgentEnv()
AgentVersion getAgentVersion()
AgentVersion getAgentVersion(HostStateEntity hostStateEntity)
hostStateEntity
- host state entityvoid setAgentVersion(AgentVersion agentVersion)
agentVersion
- the agentVersion to setHostState getState()
void setState(HostState state)
state
- Host Statevoid setStateMachineState(HostState state)
state
- String getPrefix()
void setPrefix(String prefix)
prefix
- the prefix path to setvoid handleEvent(HostEvent event) throws InvalidStateTransitionException
event
- HostEventInvalidStateTransitionException
long getTimeInState()
void setTimeInState(long timeInState)
timeInState
- the timeInState to setString getStatus()
void setStatus(String status)
status
- Host StatusHostResponse convertToResponse()
void importHostInfo(HostInfo hostInfo)
boolean addDesiredConfig(long clusterId, boolean selected, String user, Config config)
clusterId
- the cluster id that the config applies toselected
- true
if the configuration is selected. Applies
only to remove the override, otherwise this value should always be true
.user
- the user making the change for audit purposesconfig
- the configuration objecttrue
if the config was added, or false
if the config is already set as the currentMap<String,DesiredConfig> getDesiredConfigs(long clusterId)
DesiredConfig
instances.Map<String,HostConfig> getDesiredHostConfigs(Cluster cluster, Map<String,DesiredConfig> clusterDesiredConfigs) throws org.apache.ambari.server.AmbariException
cluster
- clusterDesiredConfigs
- the desired configurations for the cluster. Obtaining these can be
expensive and since this method operates on hosts, it could be
called 1,000's of times when generating host responses. Therefore,
the caller should build these once and pass them in. If
null
, then this method will retrieve them at runtime,
incurring a performance penality.org.apache.ambari.server.AmbariException
void setMaintenanceState(long clusterId, MaintenanceState state)
clusterId
- the cluster idstate
- the stateMaintenanceState getMaintenanceState(long clusterId)
clusterId
- the cluster idList<HostVersionEntity> getAllHostVersions()
boolean hasComponentsAdvertisingVersions(StackId stackId) throws org.apache.ambari.server.AmbariException
stackId
- the version of the stack to use when checking version
advertise-ability.true
if at least 1 component on this host advertises its
version.org.apache.ambari.server.AmbariException
- if there is a problem retrieving the component from the stack.ComponentInfo.isVersionAdvertised()
void calculateHostStatus(Long clusterId) throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
boolean isRepositoryVersionCorrect(RepositoryVersionEntity repositoryVersion) throws org.apache.ambari.server.AmbariException
repositoryVersion
- the repository version to check for (not null
).true
if all components on this host have checked in with
the correct version if their desired repository matches the one
specified.org.apache.ambari.server.AmbariException
Copyright © 2022 Apache Software Foundation. All rights reserved.