github.com/bigcommerce/nomad@v0.9.3-bc/terraform/examples/spark/hdfs.nomad (about)

     1  job "hdfs" {
     2  
     3    datacenters = [ "dc1" ]
     4  
     5    group "NameNode" {
     6  
     7      constraint {
     8        operator  = "distinct_hosts"
     9        value     = "true"
    10      }
    11  
    12      task "NameNode" {
    13  
    14        driver = "docker"
    15  
    16        config {
    17          image = "rcgenova/hadoop-2.7.3"
    18          command = "bash"
    19          args = [ "-c", "hdfs namenode -format && exec hdfs namenode -D fs.defaultFS=hdfs://${NOMAD_ADDR_ipc}/ -D dfs.permissions.enabled=false" ]
    20          network_mode = "host"
    21          port_map {
    22            ipc = 8020
    23            ui = 50070
    24          }
    25        }
    26  
    27        resources {
    28          memory = 500
    29          network {
    30            port "ipc" {
    31              static = "8020"
    32            }
    33            port "ui" {
    34              static = "50070"
    35            }
    36          }
    37        }
    38  
    39        service {
    40          name = "hdfs"
    41          port = "ipc"
    42        }
    43      }
    44    }
    45  
    46    group "DataNode" {
    47  
    48      count = 3
    49  
    50      constraint {
    51        operator  = "distinct_hosts"
    52        value     = "true"
    53      }
    54      
    55      task "DataNode" {
    56  
    57        driver = "docker"
    58  
    59        config {
    60          network_mode = "host"
    61          image = "rcgenova/hadoop-2.7.3"
    62          args = [ "hdfs", "datanode"
    63            , "-D", "fs.defaultFS=hdfs://hdfs.service.consul/"
    64            , "-D", "dfs.permissions.enabled=false"
    65          ]
    66          port_map {
    67            data = 50010
    68            ipc = 50020
    69            ui = 50075
    70          }
    71        }
    72  
    73        resources {
    74          memory = 500
    75          network {
    76            port "data" {
    77              static = "50010"
    78            }
    79            port "ipc" {
    80              static = "50020"
    81            }
    82            port "ui" {
    83              static = "50075"
    84            }
    85          }
    86        }
    87  
    88      }
    89    }
    90  
    91  }