Search This Blog

Sunday, 23 November 2014

PCFHawq*Web Browser based web application for PHD service within Cloud Foundry

Pivotal HD for Pivotal CF deliver's Pivotal HD - Pivotal's leading Hadoop distribution as a Pivotal CF Service. Pivotal HD is a commercially supported distribution of Apache Hadoop. The Pivotal HD Data Service includes HDFS, YARN and MapReduce. It also includes HAWQ, Pivotal's high performance SQL database on HDFS and Pivotal's In-memory OLTP SQL processing engine GemFire XD.

https://network.pivotal.io/products/pivotal-hd-service

Pivotal PCFHawq*Web is a browser based schema administration tool for HAWQ within Pivotal Cloud Foundry 1.3. It supports auto binding to a PHD service but can run stand alone outside of PCF. If you don't bind the application to a PHD instance it presents a login page to allow you to manually connect to HAWQ within PCF. When bound to a PHD service it will connect using the VCAP_SERVICES credentials automatically for you. It supports the following features

  • Browse tables/views/external tables
  • Save Query Results in CSV or JSON format
  • SQL Worksheet to load/execute SQL DML/DDL statements



Below is the GITHUB project for this tool.

More Info

https://github.com/papicella/PCFHawqWeb

Friday, 7 November 2014

Starting a Pivotal GemFireXD Distributed System from IntelliJ IDEA

The example below shows how you can start a Pivotal GemFireXD distributed system from IntelliJ IDEA. Here we will start a Locator which has Pulse enabled as well as one member. We use the following class method to achieve this from an IDE such as IntelliJ

FabricServiceManager.getFabricLocatorInstance()
FabricServiceManager.getFabricServerInstance()

1. Add the following to your maven POM file to ensure the correct libraries are present.
  
        <dependency>
            <groupId>com.pivotal.gemfirexd</groupId>
            <artifactId>gemfirexd</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.pivotal.gemfirexd</groupId>
            <artifactId>gemfirexd-client</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>8.0.14</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-logging-juli</artifactId>
            <version>8.0.14</version>
        </dependency> 

2. Create a start locator class as follows
  
package pivotal.au.gemfirexd.demos.startup;

import com.pivotal.gemfirexd.FabricLocator;
import com.pivotal.gemfirexd.FabricServiceManager;

import java.sql.SQLException;
import java.util.Properties;

/**
 * Created by papicella on 4/11/2014.
 */
public class StartLocator1
{
    public static void main(String[] args) throws SQLException, InterruptedException {
        // TODO Auto-generated method stub

        Properties serverProps = new Properties();
        serverProps.setProperty("sys-disk-dir","./gfxd/locator1");
        serverProps.setProperty("server-bind-address","localhost");
        serverProps.setProperty("jmx-manager-start","true");
        serverProps.setProperty("jmx-manager-http-port","7075");
        serverProps.setProperty("jmx-manager-bind-address","localhost");

        FabricLocator locator = FabricServiceManager.getFabricLocatorInstance();
        locator.start("localhost", 41111, serverProps);

        locator.startNetworkServer("127.0.0.1", 1527, null);

        System.out.println("Locator started ... ");
        Object lock = new Object();
        synchronized (lock) {
            while (true) {
                lock.wait();
            }
        }

    }
} 

3. Edit the run configuration to ensure you specify the GEMFIREXD ENV variable as shown below.

Note: This is needed to ensure Pulse can start when the locator starts


4. Create a start server class as follows.
  
package pivotal.au.gemfirexd.demos.startup;

import com.pivotal.gemfirexd.FabricServer;
import com.pivotal.gemfirexd.FabricServiceManager;

import java.sql.SQLException;
import java.util.Properties;

public class StartServer1
{
    public static void main(String[] args) throws SQLException, InterruptedException {
        // TODO Auto-generated method stub
        FabricServer server = FabricServiceManager.getFabricServerInstance();

        Properties serverProps = new Properties();
        serverProps.setProperty("server-groups", "mygroup");
        serverProps.setProperty("persist-dd", "false");
        serverProps.setProperty("sys-disk-dir","./gfxd/server1");
        serverProps.setProperty("host-data","true");
        serverProps.setProperty("locators", "localhost[41111]");

        server.start(serverProps);

        server.startNetworkServer("127.0.0.1", 1528, null);

        Object lock = new Object();
        synchronized (lock) {
            while (true) {
                lock.wait();
            }
        }

    }
}

5. Start the locator by running "StartLocator1" class.


6. Start one server by running "StartServer1" class.


7. Connect to pulse to verify you have a 2 node distributed system with one locator and one member.

Using URL: http://localhost:7075/pulse/Login.html




Tuesday, 4 November 2014

Starting a Pivotal GemFireXD server from Java

The FabricServer interface provides an easy way to start an embedded GemFire XD server process in an existing Java application.

In short code as follows will get you started. Use this in DEV/TEST scenarios not for production use.
  
package pivotal.au.gemfirexd.demos.startup;

import com.pivotal.gemfirexd.FabricServer;
import com.pivotal.gemfirexd.FabricServiceManager;

import java.sql.SQLException;
import java.util.Properties;

public class StartServer1
{
    public static void main(String[] args) throws SQLException, InterruptedException {
        // TODO Auto-generated method stub
        FabricServer server = FabricServiceManager.getFabricServerInstance();

        Properties serverProps = new Properties();
        serverProps.setProperty("server-groups", "mygroup");
        serverProps.setProperty("persist-dd", "false");
        serverProps.setProperty("sys-disk-dir","./gfxd/server1");
        serverProps.setProperty("host-data","true");

        server.start(serverProps);

        server.startNetworkServer("127.0.0.1", 1527, null);

        Object lock = new Object();
        synchronized (lock) {
            while (true) {
                lock.wait();
            }
        }

    }
} 

More Information

http://gemfirexd.docs.pivotal.io/latest/userguide/index.html#developers_guide/topics/server-side/fabricserver.html