In this post, we will be discussing GUI interface for Phoenix using Squirrel.
We recommend readers to go through our previous posts on Integration of HBase with Phoenix before moving ahead.
100% Free Course On Big Data Essentials
Subscribe to our blog and get access to this course ABSOLUTELY FREE.
Squirrel provides GUI to interact with phoenix. Since Phoenix is a JDBC driver, integration with tools such as Squirrel is seamless.
Installing Squirrel for Phoenix
You can download Squirrel 3.7.1 jar file from this link.
After downloading, execute the jar file using the below command.
java -jar squirrel-sql-snapshot-20160613_2107-standard.jar
After executing the command, you will be able to a screen as shown in the above screen hot. Here, click ‘Next’.
After clicking next, you will be able to see an instruction page about Squirrel as shown below. Again, click on ‘Next’.
After clicking Next, you will be asked to set the installation path of Squirrel as shown in the below screen shot.
After setting the path, you will be asked for confirmation as shown in the below screenshot. Then, click on ‘Ok’.
After clicking on Ok, it will ask for the packages to be installed. There are many optional packages; if you want to install them you can check the boxes, else not required.
After downloading, you will get the information about the packages that have been installed successfully as shown in the below screen shot. Now, click on Next.
After clicking on Next, you will be asked to create a shortcut for your Squirrel, as shown in the below screen shot.
Click on Next. You will be able to see a screen showing your installation has been successfully completed.
Finally, click on ‘Done’. Now, in your desktop, a shortcut has been created, which is in the shape of a mouse as shown in the below screen shot.
After this, you need to add the phoenix-4.7.0-Hbase-1.1-client.jar to the lib directory of squirrel-sql-snapshot-20160613_2107.
After the jar execution, a file with name squirrel-sql-snapshot-20160613_2107 will be created in your installation directory. In that directory, open the lib folder and copy that jar file.
Next, double click on the icon. Now you can see that Squirrel is starting as shown in the below screen shot.
After this, you will be able to see the UI of Phoenix.
Next, you need to add the phoenix-4.7.0-Hbase-1.1-client.jar to the lib directory of squirrel-sql-snapshot-20160613_2107. After the jar execution, a file with name squirrel-sql-snapshot-20160613_2107 will be created in your installation directory. In that directory open the lib folder and copy that jar file.
Now, on the left side, you will be able to see an option called Drivers. Click on Drivers and you will be able to see the various drivers, as shown in the below screen shot.
In the Driver dialog box, add a new driver by clicking on the + symbol.
In the Add Driver dialog box, set Name to Phoenix, and set the Example URL to jdbc:phoenix:localhost
Type “org.apache.phoenix.jdbc.PhoenixDriver” into the Class Name text box and click OK to close this dialog. You can refer to the below screen shot for the above step.
After clicking on Ok, switch to Alias tab and create the new Alias (Aliases -> New Aliases).
In the dialog box, name as following:
Name: any name
User Name: anything
Press Test (which should succeed if everything is setup correctly) and press OK to close.
After clicking on Ok, you will get a screen as shown below.
Then, click on Connect to see the message Connection Successful.
Then click on OK. You will go back to the alias creation screen. Again, click on OK followed by clicking on Connect. In the end, you will be able to see the screen similar to the one shown below.
We are done! We have successfully installed and integrated Squirrel with Phoenix.
Through Squirrel, you can issue SQL statements in the SQL tab (create tables, insert data, run queries), and inspect table metadata in the Object tab (i.e. list tables, their columns, primary keys, and types). All the Phoenix SQL commands can be executed using this Squirrel.
Now, let’s create one table in Squirrel and check in Phoenix.
create table emp(ID INTEGER NOT NULL,NAME VARCHAR(255),CONSTRAINT pk_emp PRIMARY KEY (ID,NAME));
To run your SQL command, click on session and select the option Run SQL or Run all SQLs
While executing the command, you will get a screen as shown in the below screen shot.
You can see that a table with name EMP has been created successfully. We have successfully installed and integrated Squirrel with Phoenix.
We hope this post has been helpful in installing Squirrel for Apache Phoenix. In the case of any queries, feel free to comment below and we will get back to you at the earliest.