# Controller

The Pinot Controller is responsible for a number of things

* Controllers maintain the **global metadata** (e.g. configs and schemas) of the system with the help of Zookeeper which is used as the  persistent metadata store.
* Controllers host **Helix Controller** and is responsible for managing other pinot components (brokers, servers, minions)&#x20;
* They maintain the **mapping of which servers are responsible for which segments**. This mapping is used by the servers, to download the portion of the segments that they are responsible for. This mapping is also used by the broker to decide which servers to route the queries to.
* Controller has **admin endpoints** for viewing, creating, updating and deleting configs which help us manage and operate the cluster.
* Controllers also have endpoints for **segment uploads** which are used in offline data pushes. They are responsible for initializing **realtime consumption** and coordination of persisting the realtime segments into the segment store periodically.
* They undertake other **management activities** such as managing retention of segments, validations.

There can be multiple instances of Pinot controller for redundancy. If there are multiple controllers, Pinot expects that all of them are configured with the same back-end storage system so that they have a common view of the segments (*e.g.* NFS). Pinot can use other storage systems such as HDFS or [ADLS](https://azure.microsoft.com/en-us/services/storage/data-lake-storage/).

## Starting a Controller

Make sure you've [setup Zookeeper](/release-0.4.0/basics/components/cluster.md#setup-a-pinot-cluster). If you're using docker, make sure to [pull the pinot docker image](/release-0.4.0/basics/components/cluster.md#setup-a-pinot-cluster). To start a controller

{% tabs %}
{% tab title="Docker Image" %}

```
docker run \
    --network=pinot-demo \
    --name pinot-controller \
    -p 9000:9000 \
    -d ${PINOT_IMAGE} StartController \
    -zkAddress pinot-zookeeper:2181
```

{% endtab %}

{% tab title="Launcher Scripts" %}

```
bin/pinot-admin.sh StartController \
  -zkAddress localhost:2181 \
  -clusterName PinotCluster \
  -controllerPort 9000
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pinot.apache.org/release-0.4.0/basics/components/controller.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
