2018-05-21 02:09:31 +01:00
|
|
|
{ config, lib, pkgs, ...}:
|
|
|
|
let
|
|
|
|
cfg = config.services.hadoop;
|
|
|
|
hadoopConf = import ./conf.nix { hadoop = cfg; pkgs = pkgs; };
|
|
|
|
in
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options.services.hadoop.yarn = {
|
|
|
|
resourcemanager.enabled = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to run the Hadoop YARN ResourceManager
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
nodemanager.enabled = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to run the Hadoop YARN NodeManager
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
(mkIf (
|
|
|
|
cfg.yarn.resourcemanager.enabled || cfg.yarn.nodemanager.enabled
|
|
|
|
) {
|
|
|
|
|
2018-07-02 16:57:31 +01:00
|
|
|
users.users.yarn = {
|
2018-05-21 02:09:31 +01:00
|
|
|
description = "Hadoop YARN user";
|
|
|
|
group = "hadoop";
|
|
|
|
uid = config.ids.uids.yarn;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf cfg.yarn.resourcemanager.enabled {
|
2019-08-13 22:52:01 +01:00
|
|
|
systemd.services.yarn-resourcemanager = {
|
2018-05-21 02:09:31 +01:00
|
|
|
description = "Hadoop YARN ResourceManager";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
HADOOP_HOME = "${cfg.package}";
|
|
|
|
};
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
User = "yarn";
|
|
|
|
SyslogIdentifier = "yarn-resourcemanager";
|
|
|
|
ExecStart = "${cfg.package}/bin/yarn --config ${hadoopConf} " +
|
|
|
|
" resourcemanager";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf cfg.yarn.nodemanager.enabled {
|
2019-08-13 22:52:01 +01:00
|
|
|
systemd.services.yarn-nodemanager = {
|
2018-05-21 02:09:31 +01:00
|
|
|
description = "Hadoop YARN NodeManager";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
HADOOP_HOME = "${cfg.package}";
|
|
|
|
};
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
User = "yarn";
|
|
|
|
SyslogIdentifier = "yarn-nodemanager";
|
|
|
|
ExecStart = "${cfg.package}/bin/yarn --config ${hadoopConf} " +
|
|
|
|
" nodemanager";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
];
|
|
|
|
}
|