diff options
author | illustris <rharikrishnan95@gmail.com> | 2022-01-08 14:02:32 +0530 |
---|---|---|
committer | illustris <rharikrishnan95@gmail.com> | 2022-03-09 00:06:17 +0530 |
commit | dd5f004b06a16e7c291bd159f792b718b7fce0b3 (patch) | |
tree | b7064458ec7a4d5234d64b27bf9410dc2a161f66 /nixos/modules/services | |
parent | 6efa931c518e8fdc725527e465bceb0b8fb60a4a (diff) | |
download | nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.tar nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.tar.gz nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.tar.bz2 nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.tar.lz nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.tar.xz nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.tar.zst nixpkgs-dd5f004b06a16e7c291bd159f792b718b7fce0b3.zip |
nixos/hadoop: refactor HDFS options
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/cluster/hadoop/hdfs.nix | 69 |
1 files changed, 19 insertions, 50 deletions
diff --git a/nixos/modules/services/cluster/hadoop/hdfs.nix b/nixos/modules/services/cluster/hadoop/hdfs.nix index 8c373968364..9caa3d07525 100644 --- a/nixos/modules/services/cluster/hadoop/hdfs.nix +++ b/nixos/modules/services/cluster/hadoop/hdfs.nix @@ -13,71 +13,40 @@ let ''; 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 { options.services.hadoop.hdfs = { - namenode = { - enable = mkEnableOption "HDFS NameNode"; + namenode = hadoopServiceOption { serviceName = "HDFS NameNode"; } // { formatOnInit = mkOption { type = types.bool; default = false; description = '' 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) - to initialize an HA cluster manually. - ''; - }; - inherit restartIfChanged; - openFirewall = mkOption { - type = types.bool; - default = true; - description = '' - Open firewall ports for namenode - ''; - }; - }; - datanode = { - enable = mkEnableOption "HDFS DataNode"; - inherit restartIfChanged; - openFirewall = mkOption { - type = types.bool; - default = true; - description = '' - Open firewall ports for datanode + For HA clusters, initialization involves multiple steps across multiple nodes. Follow this guide to initialize an HA cluster manually: + <link xlink:href="https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html"/> ''; }; }; - 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; + datanode = hadoopServiceOption { serviceName = "HDFS DataNode"; }; + journalnode = hadoopServiceOption { serviceName = "HDFS JournalNode"; }; + zkfc = hadoopServiceOption { + serviceName = "HDFS ZooKeeper failover controller"; + firewallOption = false; }; - httpfs = { - enable = mkEnableOption "HDFS HTTPfs server"; + httpfs = hadoopServiceOption { serviceName = "HDFS JournalNode"; } // { tempPath = mkOption { type = types.path; default = "/tmp/hadoop/httpfs"; - description = '' - HTTPFS_TEMP path used by HTTPFS - ''; - }; - inherit restartIfChanged; - openFirewall = mkOption { - type = types.bool; - default = true; - description = '' - Open firewall ports for HTTPFS - ''; + description = "HTTPFS_TEMP path used by HTTPFS"; }; }; }; |