You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ne...@apache.org on 2019/03/07 19:12:10 UTC

[incubator-pinot] 01/01: Add doc for Customizing Pinot

This is an automated email from the ASF dual-hosted git repository.

nehapawar pushed a commit to branch pinot_customization
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 5c0eda0dd4e3bbdf3c1d6214f64a006800c604d1
Author: Neha Pawar <np...@linkedin.com>
AuthorDate: Thu Mar 7 11:11:47 2019 -0800

    Add doc for Customizing Pinot
---
 docs/customizations.rst       | 151 +++++++++++++++++++++++++++++++++++++++++-
 docs/img/CustomizingPinot.png | Bin 0 -> 421572 bytes
 2 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/docs/customizations.rst b/docs/customizations.rst
index 3852028..d0e93ec 100644
--- a/docs/customizations.rst
+++ b/docs/customizations.rst
@@ -18,5 +18,152 @@
 ..
 
 
-Customization points in Pinot
-=============================
\ No newline at end of file
+Customizing Pinot
+===================
+
+There are a lot of places in Pinot which can be customized depending on the infrastructure or the use case. Below is a list of such customization points. 
+
+
+.. image:: img/CustomizingPinot.png
+
+
+1. Generating Pinot segments
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Typically, data files will be available on some offline data storage, such as HDFS, and a Hadoop job can be written to read the data and create the segment. The `SegmentCreationJob <https://github.com/apache/incubator-pinot/blob/master/pinot-hadoop/src/main/java/org/apache/pinot/hadoop/job/SegmentCreationJob.java>`_ class contains a hadoop job for creating segments. This is a map only job, and the mapper can be found in `SegmentCreationMapper <https://github.com/apache/incubator-pinot/bl [...]
+
+New offline data is typically available in a daily or hourly frequency. You can schedule your jobs to run periodically using either cron or a scheduler such as `Azkaban <https://azkaban.github.io/>`_.    
+
+
+2. Pluggable storage
+^^^^^^^^^^^^^^^^^^^^
+We expect the storage to be shared across controllers of the same cluster, such as NFS. You can write your own implementation of PinotFS to store segments in a data layer of your choice, for example Azure or S3. Please refer to `this doc <https://pinot.readthedocs.io/en/latest/pluggable_storage.html>`_ for more details.
+
+
+3. Pluggable streams
+^^^^^^^^^^^^^^^^^^^^
+We provide out of the box support for consumption from Kafka stream. You can write your own plugin in order to consume from another pub-sub stream such as Azure EventHubs or Amazon Kinesis. Refer to the `Pluggable Streams <https://pinot.readthedocs.io/en/latest/pluggable_streams.html>`_ doc for more details  
+
+
+4. Encrypting segments
+^^^^^^^^^^^^^^^^^^^^^^
+The `PinotCrypter <https://github.com/apache/incubator-pinot/blob/master/pinot-core/src/main/java/org/apache/pinot/core/crypt/PinotCrypter.java>`_ will encrypt and decrypt segments when they are uploaded to the controller or downloaded by the server. This class is especially useful in cases where segments cannot be stored unencrypted in storage. By default, we use `NoOpPinotCrypter <https://github.com/apache/incubator-pinot/blob/master/pinot-core/src/main/java/org/apache/pinot/core/crypt [...]
+
+You can write your own implementation by extending the ``org.apache.pinot.core.crypt.PinotCrypter`` interface in a similar fashion. The crypter can be used by passing the crypter class name in the header for the upload request as the header string ``CRYPTER``.
+
+
+5. Segment assignment strategies
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+We have various strategies for assigning segments to the available servers. These can be found under the `SegmentAssignmentStrategy <https://github.com/apache/incubator-pinot/blob/master/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/sharding/SegmentAssignmentStrategy.java>`_ interface. More details about which one to use depending on your usecase can be found in `Tuning Pinot <https://pinot.readthedocs.io/en/latest/tuning_pinot.html>`_. By default, the `BalanceNum [...]
+
+You can also write your own by implementing the ``org.apache.pinot.controller.helix.core.sharding.SegmentAssignmentStrategy`` interface. The segment assignment strategy can be configured for a table by setting it in the table config as 
+
+
+.. code-block:: none
+
+    {
+        "segmentsConfig": {
+            "segmentAssignmentStrategy": "BalanceNumSegmentAssignmentStrategy",
+            ...
+        }
+    }
+
+
+6. Data partitioning strategies
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+We have various algorithms to partition data during segment creation, as listed under the interface `PartitionFunction <https://github.com/apache/incubator-pinot/blob/master/pinot-core/src/main/java/org/apache/pinot/core/data/partition/PartitionFunction.java>`_. No partitioning is done by default. You can write your own partitioning function by implementing the interface for ``org.apache.pinot.core.data.partition.PartitionFunction``. The partitioning function can be configured on the req [...]
+
+
+.. code-block:: none
+
+    {
+         "segmentPartitionConfig": {
+            "columnPartitionMap": {
+                "userId": {
+                    "functionName": "murmur",
+                    "numPartitions": 10
+                }
+            }
+        }
+    }
+
+
+7. Routing strategies
+^^^^^^^^^^^^^^^^^^^^^
+We have many routing strategies which you can find under the `RoutingTableBuilder <https://github.com/apache/incubator-pinot/blob/master/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/RoutingTableBuilder.java>`_ interface. More details about which one to use depending on your usecase can be found in `Tuning Pinot <https://pinot.readthedocs.io/en/latest/tuning_pinot.html>`_. By default we will use `DefaultOfflineRoutingTableBuilder <https://github.com/apache/incubator- [...]
+
+You can write your own routing table builder by implementing the ``org.apache.pinot.broker.routing.builder.RoutingTableBuilder`` interface. The routing table builder can be set in the table config as 
+
+
+.. code-block:: none
+
+    {
+	"routing": {
+            "routingTableBuilderName": "PartitionAwareRealtime",
+            "routingTableBuilderOptions": {}
+        }
+    }
+
+
+8. Broker endpoint
+^^^^^^^^^^^^^^^^^^
+If you setup a usecase to have multiple brokers, you will have to develop your restful service to accept queries and distribute them across the brokers
+
+
+9. Access Control
+^^^^^^^^^^^^^^^^^
+Access control can be setup at various points in Pinot, such as controller endpoints and broker query endpoints. By default we will use `AllowAllAccessFactory <https://github.com/apache/incubator-pinot/blob/master/pinot-controller/src/main/java/org/apache/pinot/controller/api/access/AllowAllAccessFactory.java>`_ and hence not be enforcing any access controls. You can add access control by implementing the `AccessControlFactory <https://github.com/apache/incubator-pinot/blob/master/pinot- [...]
+
+The access control factory can be configured in the controller configs by setting the fully qualified class name of the AccessControlFactory in the property
+``controller.admin.access.control.factory.class``
+The access control factory can be configured in the broker configs by setting the fully qualified class name of the AccessControlFactory in the property
+``pinot.broker.access.control.class``
+Any other properties required for initializing the factory can be set in the broker configs as properties with the prefix "pinot.broker.access.control".
+
+
+10. Minion tasks 
+^^^^^^^^^^^^^^^^
+Minion tasks can be configured for background activities such as purging data, adding indexes, merging segments. The existing minion tasks can be found under the `PinotTaskExecutor <https://github.com/apache/incubator-pinot/blob/master/pinot-minion/src/main/java/org/apache/pinot/minion/executor/PinotTaskExecutor.java>`_ interface. You can create your own minion task by implementing the PinotTaskExecutor and the `PinotTaskExecutorFactory <https://github.com/apache/incubator-pinot/blob/mas [...]
+
+
+.. code-block:: none
+
+    {
+         "task": {
+            "taskTypeConfigsMap": {
+              "PurgeTask": {}
+            }
+        }
+    }
+
+
+11. Custom configs
+^^^^^^^^^^^^^^^^^^
+Custom configs can be injected into Pinot by adding the customConfigs field in the table config. This field accepts key value pairs.
+
+
+.. code-block:: none
+
+    {
+	"customConfigs": {
+    	    "specialConfig": "testValue",
+    	    "anotherSpecialConfig": "value"
+        }
+    }
+
+
+12. Metrics 
+^^^^^^^^^^^
+We use `yammer MetricsRegistry <https://metrics.dropwizard.io/4.0.0/>`_ to collect metrics within our application components. These metrics can be published to a metrics server with the help of `MetricsRegistryRegistrationListener <https://github.com/apache/incubator-pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/metrics/MetricsRegistryRegistrationListener.java>`_ interface. By default, we publish metrics to JMX using the `JmxReporterMetricsRegistryRegistrationListe [...]
+
+You can write a listener to publish metrics to another metrics server by implementing the  ``MetricsRegistryRegistrationListener`` interface. This listener can be injected into the controller by setting the fully qualified name of the class in the controller configs for the property ``pinot.controller.metrics.metricsRegistryRegistrationListeners``.
+
+You would have to design your own systems to view and monitor these metrics. A list of all the metrics published for each component can be found in `ControllerMeter <https://github.com/apache/incubator-pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java>`_, `ControllerGauge <https://github.com/apache/incubator-pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java>`_, `BrokerMeter <https://github.com [...]
+
+
+13. Deployables 
+^^^^^^^^^^^^^^^
+You can deploy pinot server, broker, controller and minion individually. You can either use out of the box jars and start the components via `PinotAdministrator <https://github.com/apache/incubator-pinot/blob/master/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java>`_, or run via scripts as described in the `Quick Start Guide <https://pinot.readthedocs.io/en/latest/getting_started.html#>`_
+
+The starter classes for pinot controller, broker, server and minion are `ControllerStarter <https://github.com/apache/incubator-pinot/blob/master/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerStarter.java>`_, `HelixBrokerStarter <https://github.com/apache/incubator-pinot/blob/master/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/HelixBrokerStarter.java>`_, `HelixServerStarter <https://github.com/apache/incubator-pinot/blob/master/pinot-server/src/m [...]
+
+
diff --git a/docs/img/CustomizingPinot.png b/docs/img/CustomizingPinot.png
new file mode 100644
index 0000000..1991d66
Binary files /dev/null and b/docs/img/CustomizingPinot.png differ


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org