nixos/hadoop: refactor HDFS options
This commit is contained in:
@@ -13,71 +13,40 @@ let
|
|||||||
'';
|
'';
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
openFirewall = serviceName: mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Open firewall ports for ${serviceName}.";
|
||||||
|
};
|
||||||
|
hadoopServiceOption = { serviceName, firewallOption ? true }: {
|
||||||
|
enable = mkEnableOption serviceName;
|
||||||
|
inherit restartIfChanged;
|
||||||
|
} // (if firewallOption then {openFirewall = openFirewall serviceName;} else {});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.hadoop.hdfs = {
|
options.services.hadoop.hdfs = {
|
||||||
namenode = {
|
namenode = hadoopServiceOption { serviceName = "HDFS NameNode"; } // {
|
||||||
enable = mkEnableOption "HDFS NameNode";
|
|
||||||
formatOnInit = mkOption {
|
formatOnInit = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Format HDFS namenode on first start. This is useful for quickly spinning up ephemeral HDFS clusters with a single namenode.
|
Format HDFS namenode on first start. This is useful for quickly spinning up ephemeral HDFS clusters with a single namenode.
|
||||||
For HA clusters, initialization involves multiple steps across multiple nodes. Follow [this guide](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html)
|
For HA clusters, initialization involves multiple steps across multiple nodes. Follow this guide to initialize an HA cluster manually:
|
||||||
to initialize an HA cluster manually.
|
<link xlink:href="https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html"/>
|
||||||
'';
|
|
||||||
};
|
|
||||||
inherit restartIfChanged;
|
|
||||||
openFirewall = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Open firewall ports for namenode
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
datanode = {
|
datanode = hadoopServiceOption { serviceName = "HDFS DataNode"; };
|
||||||
enable = mkEnableOption "HDFS DataNode";
|
journalnode = hadoopServiceOption { serviceName = "HDFS JournalNode"; };
|
||||||
inherit restartIfChanged;
|
zkfc = hadoopServiceOption {
|
||||||
openFirewall = mkOption {
|
serviceName = "HDFS ZooKeeper failover controller";
|
||||||
type = types.bool;
|
firewallOption = false;
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Open firewall ports for datanode
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
journalnode = {
|
httpfs = hadoopServiceOption { serviceName = "HDFS JournalNode"; } // {
|
||||||
enable = mkEnableOption "HDFS JournalNode";
|
|
||||||
inherit restartIfChanged;
|
|
||||||
openFirewall = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Open firewall ports for journalnode
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
zkfc = {
|
|
||||||
enable = mkEnableOption "HDFS ZooKeeper failover controller";
|
|
||||||
inherit restartIfChanged;
|
|
||||||
};
|
|
||||||
httpfs = {
|
|
||||||
enable = mkEnableOption "HDFS HTTPfs server";
|
|
||||||
tempPath = mkOption {
|
tempPath = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "/tmp/hadoop/httpfs";
|
default = "/tmp/hadoop/httpfs";
|
||||||
description = ''
|
description = "HTTPFS_TEMP path used by HTTPFS";
|
||||||
HTTPFS_TEMP path used by HTTPFS
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
inherit restartIfChanged;
|
|
||||||
openFirewall = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Open firewall ports for HTTPFS
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user