jujubigdata.handlers

jujubigdata.handlers.HDFS
jujubigdata.handlers.HadoopBase
jujubigdata.handlers.YARN
class jujubigdata.handlers.HDFS(hadoop_base)

Bases: object

bootstrap_standby()
configure_client(clustername, namenodes, port, webhdfs_port)
configure_datanode(clustername, namenodes, port, webhdfs_port)
configure_hdfs_base(clustername, namenodes, port, webhdfs_port)
configure_journalnode()
configure_namenode(namenodes)
configure_zookeeper(zookeepers)
create_hdfs_dirs()
ensure_HA_active(namenodes, leader)

Function to ensure one namenode in an HA Initialized cluster is in active and one is in standby in the absence of zookeeper to handle automatic failover

format_namenode()
format_zookeeper()
init_sharededits()
register_journalnodes(nodes, port)
register_slaves(slaves)
reload_slaves()
restart_datanode()
restart_dfs()
restart_journalnode()
restart_namenode()
restart_zookeeper()
start_datanode()
start_dfs()
start_journalnode()
start_namenode()
start_secondarynamenode()
start_zookeeper()
stop_datanode()
stop_dfs()
stop_journalnode()
stop_namenode()
stop_secondarynamenode()
stop_zookeeper()
transition_to_active(serviceid)
class jujubigdata.handlers.HadoopBase(dist_config)

Bases: object

close_ports(service)
configure_hadoop()
configure_hosts_file()

Add the unit’s private-address to /etc/hosts to ensure that Java can resolve the hostname of the server to its real IP address. We derive our hostname from the unit_id, replacing / with -.

install(force=False)
install_base_packages()
install_hadoop()
install_java()

Run the java-installer resource to install Java and determine the JAVA_HOME and Java version.

The java-installer must be idempotent and its only output (on stdout) should be two lines: the JAVA_HOME path, and the Java version, respectively.

If there is an error installing Java, the installer should exit with a non-zero exit code.

is_installed()
open_ports(service)
register_slaves(slaves)

Add slaves to a hdfs or yarn master, determined by the relation name.

Parameters:relation (str) – ‘datanode’ for registering HDFS slaves; ‘nodemanager’ for registering YARN slaves.
run(user, command, *args, **kwargs)

Run a Hadoop command as the hdfs user.

Parameters:
  • command (str) – Command to run, prefixed with bin/ or sbin/
  • args (list) – Additional args to pass to the command
setup_hadoop_config()
setup_init_script(user, servicename)
spec()

Generate the full spec for keeping charms in sync.

NB: This has to be a callback instead of a plain property because it is passed to the relations during construction of the Manager but needs to properly reflect the Java version in the same hook invocation that installs Java.

class jujubigdata.handlers.YARN(hadoop_base)

Bases: object

configure_client(host, port, history_http, history_ipc)
configure_jobhistory()
configure_nodemanager(host, port, history_http, history_ipc)
configure_resourcemanager()
configure_yarn_base(host, port, history_http, history_ipc)
install_demo()
register_slaves(slaves)
restart_nodemanager()
restart_resourcemanager()
start_jobhistory()
start_nodemanager()
start_resourcemanager()
stop_jobhistory()
stop_nodemanager()
stop_resourcemanager()