Database Reference
In-Depth Information
$ IP=$(ip=`hostname -I` && ip=( ${ip//\./ } ) \
> && echo "(${ip[0]} * (2^24)) + (${ip[1]}*(2^16)) \
> + (${ip[2]}*(2^8)) + ${ip[3]}" | bc) \
> && echo "broker.id: $IP"
This command uses the Linux hostname command to obtain the “default”
IP address using the -I option. This is broken up into its component parts
by ip=(${ip//\./ }) . Note that the trailing space after the “/” character
is important and cannot be omitted. These component parts are then
bit-shifted by multiplying them appropriately using the bc command.
The broker.id value should only be set during initial configuration and
the IP address is used only to ensure unique IDs during cluster setup. If the
server receives a new IP address due to being restarted, it should retain its
current broker.id . Of course, problems can arise when new servers are
addedandreceiveanIPaddressthathadbeenassignedduringinitialcluster
configuration.
The next parameter is the port the broker uses for communication. The
default is 9092 and there is little reason to change it unless multiple broker
instances are toberun on thesame machine (see theA Multi-Broker Cluster
on a Single Machine section):
# The port the socket server listens on
port=9092
The host.name option is used to set the host name reported by the broker.
In most circumstances, this can be left commented out because
getCanonicalHostName() does the correct thing. If the compute
environment is somewhat exotic and a server has multiple hostnames, it
may be necessary to set this explicitly. One example of this is Amazon's EC2
environment. Each server in EC2 has at least two fully qualified domain
names—an internal and an external domain—and may have other names
assigned using Amazon's Route 53 DNS service. Depending on which
services need to communicate with the cluster, the default name may not be
appropriate to report. If this problem cannot be overcome at the operating
systemlevel,itispossibletoexplicitlydefinethenameheresothatmetadata
calls return the correct hostname.
Search WWH ::




Custom Search