6.3.2. Creating and Populating Districts
Use the
oo-admin-ctl-district
command on the broker host to administer districts.
Note
Districts work with gear profiles to manage nodes. A default gear profile is defined in the
/etc/openshift/broker.conf
file on the broker host, and is created in the following procedure. For information on how to change the default gear profile, see Section 6.1, “Adding or Modifying Gear Profiles”.
Procedure 6.3. To Create and Populate Districts:
- Create a district using the following command:
#
oo-admin-ctl-district -c create -n District_Name -p Gear_Profile
- Add a node to the district using the following command:
#
oo-admin-ctl-district -c add-node -n District_Name -i Node_Hostname
Alternatively, create a district and add nodes to it simultaneously with the following command. Note that you can add multiple node hosts with the
-i
option and any node hostnames, or use the --available
option to add all undistricted nodes of the specified size:
# oo-admin-ctl-district -c add-node -n District_Name -p Gear_Profile -i Node_Hostname1,Node_Hostname2
The following examples use the
small
gear profile to create a district named small_district
, then add the node host node1.example.com
to the new district:
Example 6.3. Creating a District Named small_district
:
# oo-admin-ctl-district -c create -n small_district -p small
Successfully created district: 7521a7801686477f8409e74f67b693f4
{"_id"=>"53443b8b87704f23db000001",
"active_servers_size"=>1,
"available_capacity"=>6000,
"available_uids"=>"<6000 uids hidden>",
"created_at"=>2014-04-08 18:10:19 UTC,
"gear_size"=>"small",
"max_capacity"=>6000,
"max_uid"=>6999,
"name"=>"default-small-0",
"servers"=> [],
"updated_at"=>2014-04-08 18:10:19 UTC,
"uuid"=>"53443b8b87704f23db000001"}
Example 6.4. Adding node1.example.com
to the District:
# oo-admin-ctl-district -c add-node -n small_district -i node1.example.com
Success!
{"_id"=>"53443b8b87704f23db000001",
"active_servers_size"=>1,
"available_capacity"=>6000,
"available_uids"=>"<6000 uids hidden>",
"created_at"=>2014-04-08 18:10:19 UTC,
"gear_size"=>"small",
"max_capacity"=>6000,
"max_uid"=>6999,
"name"=>"default-small-0",
"servers"=>
[{"_id"=>"53443bbc87704f49bd000001",
"active"=>true,
"name"=>"node1.example.com",
"unresponsive"=>false}],
"updated_at"=>2014-04-08 18:10:19 UTC,
"uuid"=>"53443b8b87704f23db000001"}
Important
The server identity,
node1.example.com
in the above example, is the node's host name as configured on that server, which could be different from the PUBLIC_HOSTNAME
configured in the /etc/openshift/node.conf
file on the node. CNAME records use the PUBLIC_HOSTNAME
parameter, which must resolve to the host through DNS; the host name could be something completely different and may not resolve in DNS at all.
MongoDB records the host name both in the district and with any gears hosted on the node host, so changing the node's host name disrupts the broker's ability to use the node. Red Hat
recommends using the host name as the DNS name and not changing either after deployment.