GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.voltdb.com — 15.7. The HTTP Export Connector Documentation15.7. The HTTP Export ConnectorThe HTTP connector receives the serialized data from the export streams and writes it out via HTTP requests. The connector is designed to be flexible enough to accommodate most potential targets. For example, the connector can be configured to send out individual records using a GET request or batch multiple records using POST and PUT requests. The connector also contains optimizations to support export to Hadoop via WebHDFS. 15.7.1. Understanding HTTP PropertiesThe HTTP connector is a general purpose export utility that can export to any number of destinations from simple messaging services to more complex REST APIs. The properties work together to create a consistent export process. However, it is important to understand how the properties interact to configure your export correctly. The four key properties you need to consider are:
The properties are described in detail in Table 15.2, “HTTP Export Properties”. This section explains the relationship between the properties. There are essentially two types of HTTP export: batch mode and one record at a time. Batch mode is appropriate for exporting large volumes of data to targets such as Hadoop. Exporting one record at a time is less efficient for large volumes but can be very useful for writing intermittent messages to other services. In batch mode, the data is exported using a POST or PUT method, where multiple records are combined in either
command-separated value (CSV) or Avro format in the body of the request. When writing one record at a time, you can choose
whether to submit the HTTP request as a POST, PUT or GET (that is, as a querystring attached to the URL). When exporting
in batch mode, the method must be either Finally, the endpoint property specifies the target URL where data is being sent, using either the http: or https: protocol. Again, the endpoint must be compatible with the possible settings for the other properties. In particular, if the endpoint is a WebHDFS URL, batch mode must enabled. The URL can also contain placeholders that are filled in at runtime with metadata associated with the export data. Each placeholder consists of a percent sign (%) and a single ASCII character. The following are the valid placeholders for the HTTP endpoint property:
When exporting in batch mode, the endpoint must contain at least one instance each of the %t, %p, and %g placeholders. However, beyond that requirement, it can contain as many placeholders as desired and in any order. When not in batch mode, use of the placeholders are optional. Table 15.2, “HTTP Export Properties” describes the supported properties for the HTTP connector. Table 15.2. HTTP Export Properties
15.7.2. Exporting to Hadoop via WebHDFSAs mentioned earlier, the HTTP connector contains special optimizations to support exporting data to Hadoop via the WebHDFS protocol. If the endpoint property contains a WebHDFS URL (identified by the URL path component starting with the string "/webhdfs/v1/"), special rules apply. First, for WebHDFS URLs, the batch.mode property must be enabled. Also, the endpoint must have at least one instance each of the stream name (%t), the partition ID (%p), and the export generation (%g) placeholders and those placeholders must be part of the URL path, not the domain or querystring. Next, the method property is ignored. For WebHDFS, the HTTP connector uses a combination of POST, PUT, and GET requests to perform the necessary operations using the WebHDFS REST API. For example, The following configuration file excerpt exports stream data to WebHDFS using the HTTP connector and writing each stream to a separate directory, with separate files based on the partition ID, generation, and period timestamp, rolling over every 2 hours: <export>
<configuration target="hadoop" enabled="true" type="http">
<property name="endpoint">
http://myhadoopsvr/webhdfs/v1/%t/data%p-%g.%d.csv
</property>
<property name="batch.mode">true</property>
<property name="period">2</property>
</configuration>
</export>Note that the HTTP connector will create any directories or files in the WebHDFS endpoint path that do not currently exist and then append the data to those files, using the POST or PUT method as appropriate for the WebHDFS REST API. You also have a choice between two formats for the export data when using WebHDFS: comma-separated values (CSV) and
Apache Avro™ format. By default, data is written as CSV data with each record on a separate line and batches of records
attached as the contents of the HTTP request. However, you can choose to set the output format to Avro by setting the
<export>
<configuration target="hadoop" enabled="true" type="http">
<property name="endpoint">
http://myhadoopsvr/webhdfs/v1/%t/data%p-%g.%d.avro
</property>
<property name="type">avro</property>
<property name="avro.compress">true</property>
<property name="avro.schema.location">
http://myhadoopsvr/webhdfs/v1/%t/schema.json
</property>
</configuration>
</export>Avro is a data serialization system that includes a binary format that is used natively by Hadoop utilities such as
Pig and Hive. Because it is a binary format, Avro data takes up less network bandwidth than text-based formats such as
CSV. In addition, you can choose to compress the data even further by setting the When you select Avro as the output format, VoltDB writes out an accompanying schema definition as a JSON document. For compatibility purposes, the stream name and columns names are converted, removing underscores and changing the resulting words to lowercase with initial capital letters (sometimes called "camelcase"). The stream name is given an initial capital letter, while columns names start with a lowercase letter. For example, the stream EMPLOYEE_DATA and its column named EMPLOYEE_iD would be converted to EmployeeData and employeeId in the Avro schema. By default, the Avro schema is written to a local file on the VoltDB database server. However, you can specify an
alternate location, including a webHDFS URL. So, for example, you can store the schema in the same HDFS repository as the
data by setting the See the Apache Avro web site for more details on the Avro format. 15.7.3. Exporting to Hadoop Using Kerberos SecurityIf the WebHDFS service to which you are exporting data is configured to use Kerberos security, the VoltDB servers must be able to authenticate using Kerberos as well. To do this, you must perform the following two extra steps:
The first step is to configure the VoltDB servers to use Kerberos as described in Section 12.7, “Integrating Kerberos Security with VoltDB”. Because use of Kerberos authentication for VoltDB security changes how the clients connect to the database cluster, It is best to set up, enable, and test Kerberos authentication first to ensure your client applications work properly in this environment before trying to enable Kerberos export as well. Once you have Kerberos authentication working for the VoltDB cluster, you can enable Kerberos authentication in the
configuration of the WebHDFS export target as well. Enabling Kerberos authentication in the HTTP connector only requires
one additional property, <export>
<configuration target="hadoop" enabled="true" type="http">
<property name="endpoint">
http://myhadoopsvr/webhdfs/v1/%t/data%p-%g.%d.csv
</property>
<property name="type">csv</property>
<property name="kerberos.enable">true</property>
</configuration>
</export>Note that Kerberos authentication is only supported for WebHDFS endpoints. | ||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | ||||||||||||||||||||||||||||||||||||||||||||||