Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

It will also create/setup a service which can be used to start/stop/restart kafka,

service kafka [start|stop|restart|status]

We also link kafka's log directory to /var/log/kafka to make it easier to find kafka's logs.

Usage

These are the requirements that need to be satisfied in order to get the cookbook to run.

Have filled out the following required attributes

node["kafka"]["brokers"] or node["kafka"]["server.properties"]["broker.id"]

node["kafka"]["zookeepers"] or node["kafka"]["server.properties"]["zookeeper.connect"]

If you don't fulfill the requirements the recipe will error out telling you what was missing.

Additionally if you want to use a Zookeeper chroot with your kafka installation you can provide it by setting
node["kafka"]["zookeeper_chroot"].

The attributes,

node["kafka"]["brokers"]

node["kafka"]["zookeepers"]

Actually map to 'server.properties' settings,

node["kafka"]["server.properties"]["broker.id"] : The id of broker running on the server

node["kafka"]["server.properties"]["zookeeper.connect"] : The Kafka configuration used to connect to Zookeeper

We do this mapping for you when you provide the node["kafka"]["brokers"] and node["kafka"]["zookeepers"]
attributes.

For the node["kafka"]["brokers"] => node["kafka"]["server.properties"]["broker.id"] mapping to work properly
all Chef nodes running the kafka recipe (and are part of the same Kafka cluster) must have the same list of
node["kafka"]["brokers"] and all broker hostnames must be in the same order. We determine the
node["kafka"]["server.properties"]["broker.id"] by using the index of Chef node's fqdn/hostname/ip in the
list as the node["kafka"]["server.properties"]["broker.id"].

Using node["kafka"]["brokers"], node["kafka"]["zookeepers"] and node["kafka"]["zookeeper_chroot"] attribtues are
the recommended way to setup your kafka cluster in Chef.

Once all that is done you should be able to run the recipe without any problem.

How to specify where to download kafka from and which version to install

This cookbook supports Kafka version 0.8.1.1 and above. The default attributes currently will install version 0.8.1.1 from
'https://archive.apache.org/dist/kafka'. This is configured using a number of different attributes in order to make it easier for you.

There are basically two ways to configure these settings. The first way is via 3 different attributes,

node["kafka"]["scala_version"] : The scala version number associated with the kafka installation (default="2.9.2")

node["kafka"]["version"] : The version number associated with the kafka installation (default="0.8.1.1")

You can customize these environment variables (as well as any environment variable for the kafka user) using the
attribute,

node["kafka"]["env_vars"] : A hash of environment variable names to their values to be set for the kafka user

Consumer Offset Monitor

The kafka::offset_monitor recipe will install the Kafka Consumer Offset Monitor application, which provides a
web UI for monitoring various aspects of your Kafka cluster, including consumer processing lag.

This recipe shares several attributes with the default recipe:

node["kafka"]["zookeepers"] (required)

node["kafka"]["user"]

node["kafka"]["group"]

node["kafka"]["base_dir"]

node["kafka"]["log_dir"]

The offset monitor application is installed to node["kafka"]["offset_monitor"]["install_dir"]
(defaults to node["kafka]["base_dir"]/kafka-offset-monitor). The application download URL is controlled by
the node["kafka"]["offset_monitor"]["url"] attribute.

The offset monitor maintains an SQLite database comparing the latest Kafka broker offset for each
topic partition to the latest offset persisted in Zookeeper for each consumer group. The database file
(node["kafka"]["offset_monitor"]["db_name"].db) is written to the kafka user's home directory. The monitoring
refresh interval and retention period are configurable by the attributes node["kafka"]["offset_monitor"]["refresh"]
and node["kafka"]["offset_monitor"]["retain"] using scala.concurrent.duration.Duration syntax (for example
"60.seconds" or "30.days").

The offset monitor web application listens on port 8080 by default. The port is configurable by setting the
node["kafka"]["offset_monitor"]["port"] attribute in the event that a conflicting service is already using port
8080.

This recipe is not included by the default recipe. It can be added to any or all of the Kafka broker nodes,
or a separate node or VM. Each instance of the offset monitor will collect an identical complete data set
for the entire Kafka cluster regardless of where it is installed, other than minor variances due to refresh interval
asynchronicities.

This recipe creates a service which can be used to start/stop/restart the offset monitor java process,

service kafka-offset-monitor [start|stop|restart|status]

Log files are written to kafka-offset-monitor.log in node["kafka"]["log_dir"] (defaults to /var/log/kafka).

Attributes

node["kafka"]["brokers"] : An array of the list of brokers in the Kafka cluster. This should even include the node running the recipe. (default=[])

node["kafka"]["zookeepers"] : An array of the list of Zookeepers that Kafka uses. (default=[])

node["kafka"]["zookeeper_chroot"] : A string representing the Zookeeper chroot to use for Kafka. (default=nil)

node["kafka"]["user"] : The name of the user used to run Kafka (default="kafka")

node["kafka"]["group"] : The name of the group the user running Kafka is associated with (default="kafka")

node["kafka"]["openFileLimit"] : The open file limit for the user running the Kafka service (default=32768)

node["kafka"]["maxProcesses"] : The max processes allowed for the user running the Kafka service (default=1024)

node["kafka"]["scala_version"] : The scala version number associated with the kafka installation (default="2.9.2")

node["kafka"]["version"] : The version number associated with the kafka installation (default="0.8.1.1")

node["kafka"]["download_url"] : The base url used to download Kafka. Uses this and node["kafka"]["scala_version"] as well as node["kafka"]["version"] to build the full url. (default="https://archive.apache.org/dist/kafka")

node["kafka"]["binary_url"] : The full url used to download Kafka. (default=#{node["kafka"]["download_url"]}/#{node["kafka"]["version"]}/kafka_#{node["kafka"]["scala_version"]}-#{node["kafka"]["version"]}.tgz)

node["kafka"]["base_dir"] : This is the directory that contains the current installation as well as every other installation (default="/opt")

node["kafka"]["install_dir"] : This is the directory of the current installation (default=node["kafka"]["base_dir"]/kafka)

node["kafka"]["log_dir"] : The directory of the log files for Kafka. Not Kafka's message/log data but debug logs from the server. (default="/var/log/kafka")

Contributing

This project is licensed under the Apache License, Version 2.0.

When contributing to the project please add your name to the CONTRIBUTORS.txt file. Adding your name to the CONTRIBUTORS.txt file
signifies agreement to all rights and reservations provided by the License.

To contribute to the project execute a pull request through github. The pull request will be reviewed by the community and merged
by the project committers. Please attempt to conform to the test, code conventions, and code formatting standards if any
are specified by the project before submitting a pull request.

Releases

Releases should happen regularly after most changes. Feel free to request a release by logging an issue.

Committers

LICENSE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.