kudu-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Attila Bukor <abu...@apache.org>
Subject Re: Custom Kudu App failed to connect SSL enabled server
Date Thu, 14 Feb 2019 18:41:22 GMT
Sure, you can do that. The clients are backwards compatible, so what
woked on 1.1.0 should work on 1.8.0.
On Thu, Feb 14, 2019 at 10:24:56PM +0400, Madheswaran Thangavel wrote:
> Hi Attila,
> Thank you so much for your quick reply.
> I am trying to use the Java example program to connect  Kudu. So my
> question is whether I can use the same java example program (1.8.0)
> without any modification to connect Kudu server  ( Which is SSL enabled) or
> not?.
> 
> Regards,
> Mdheswaran
> 
> On Thu, Feb 14, 2019 at 9:32 PM Attila Bukor <abukor@apache.org> wrote:
> 
> > Hi Madheswaran,
> >
> > Is this the java-sample script application from Clouera's kudu-example
> > repository? If it is, it's using Kudu client version 1.1.0 which doesn't
> > support TLS yet.
> >
> > You should update it to a more recent version (the latest one is 1.8.0)
> > and it should work.
> >
> > Also, these examples have been merged into the apache/kudu repository
> > under the examples directory and they also have been updated since then,
> > you can review them here:
> > https://github.com/apache/kudu/tree/master/examples
> >
> > Attila
> >
> > On Thu, Feb 14, 2019 at 11:01:00AM +0400, Madheswaran Thangavel wrote:
> > > Hi,
> > >
> > > I try to run the below sample java program to connect Kudu server, but it
> > > got failed to connect the Kudu server ( SSL enabled).
> > >
> > > Attached error log screenshot.
> > >
> > > Program :
> > >
> > > package org.kududb.examples.sample;
> > > import org.apache.kudu.ColumnSchema;
> > > import org.apache.kudu.Schema;
> > > import org.apache.kudu.Type;
> > > import org.apache.kudu.client.*;
> > > import java.util.ArrayList;
> > > import java.util.List;
> > > public class Sample {
> > > private static final String KUDU_MASTER = System.getProperty(
> > > "kuduMaster", "quickstart.cloudera");
> > > public static void main(String[] args) {
> > > System.out.println("-----------------------------------------------");
> > > System.out.println("Will try to connect to Kudu master at " +
> > KUDU_MASTER);
> > > System.out.println("Run with -DkuduMaster=myHost:port to override.");
> > > System.out.println("-----------------------------------------------");
> > > String tableName = "java_sample-" + System.currentTimeMillis();
> > > KuduClient client = new
> > KuduClient.KuduClientBuilder(KUDU_MASTER).build();
> > > try {
> > > List<ColumnSchema> columns = new ArrayList(2);
> > > columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.INT32)
> > > .key(true)
> > > .build());
> > > columns.add(new ColumnSchema.ColumnSchemaBuilder("value", Type.STRING)
> > > .build());
> > > List<String> rangeKeys = new ArrayList<>();
> > > rangeKeys.add("key");
> > > Schema schema = new Schema(columns);
> > > client.createTable(tableName, schema,
> > > new CreateTableOptions().setRangePartitionColumns(rangeKeys));
> > > KuduTable table = client.openTable(tableName);
> > > KuduSession session = client.newSession();
> > > for (int i = 0; i < 3; i++) {
> > > Insert insert = table.newInsert();
> > > PartialRow row = insert.getRow();
> > > row.addInt(0, i);
> > > row.addString(1, "value " + i);
> > > session.apply(insert);
> > > }
> > > List<String> projectColumns = new ArrayList<>(1);
> > > projectColumns.add("value");
> > > KuduScanner scanner = client.newScannerBuilder(table)
> > > .setProjectedColumnNames(projectColumns)
> > > .build();
> > > while (scanner.hasMoreRows()) {
> > > RowResultIterator results = scanner.nextRows();
> > > while (results.hasNext()) {
> > > RowResult result = results.next();
> > > System.out.println(result.getString(0));
> > > }
> > > }
> > > } catch (Exception e) {
> > > e.printStackTrace();
> > > } finally {
> > > try {
> > > client.deleteTable(tableName);
> > > } catch (Exception e) {
> > > e.printStackTrace();
> > > } finally {
> > > try {
> > > client.shutdown();
> > > } catch (Exception e) {
> > > e.printStackTrace();
> > > }
> > > }
> > > }
> > > }
> > > }
> > > *Execution *:
> > >  java -DkuduMaster=hadoop1.kudu.com -jar
> > kudu-java-sample-1.0-SNAPSHOT.ja
> > > r
> > >
> > >
> > > Regards,
> > > Madheswaran
> >
> >
> >
> >

Mime
View raw message