Server-side Project Setup Guide


1. System Requirements
2. Installing Git And Clone the project
3. Project Basic environments setup
4. Environments that needs to be configured Manually
    1). Configure Java Environment Variables
    2). Configure MySQL
    3). Configure project config file
    4). Add priviledge to project folder
    5). Enable start-server and stop-server scripts
    6). Configure the web client
5. Build the project by using maven
6. launch the server
7. check the web client


1. System Requirements


To successfully build and run the project, you need the following:

1). A 64 bit linux system.
2). Oracle java 8.

To follow this guide, you'd better use a system with apt-get like ubuntu.
In center OS and Redhat, commands are different, especially when installing java8.
(See this for more information on installing oracle jdk 8.)

2. Installing Git And Clone the project


To download the project, we need to install git first using this command:

sudo apt-get install git

After installation, we can begin to clone our project into the server machine.
By default, we place the project into /opt/project folder.

cd /opt
sudo mkdir project
cd project
sudo git clone https://github.com/infsci2711/MultiDBs-Query-Server.git


3. Project Basic environments setup


We now download all dependencies and initialize the database of the project with the setup.sh script:

When installing MySQL, please use 'proot' as password of root user. Later you may change it.

cd MultiDBs-Query-Server
sudo chmod +x ./setup.sh
./setup.sh

Follow all setup guides in the console.

What does the script do?

First, it installed java 8.
Second, it installed maven, mysql, and nginx.
Third, it made a directory for presto logs.
Finally, it initialized the database.


4. Environments that needs to be configured Manually


We now have to configure some environments manually:

1). Configure Java Environment Variables

sudo nano /etc/profile

use down arrow to go to the end of the file, press enter
Add the following lines:

Path=$PATH:/usr/lib/jvm/java-8-oracle/bin
export JAVA_Home=/usr/lib/jvm/java-8-oracle
export CLASSPATH=$JAVA_HOME/lib:.

close the file by ctrl+x, follow the guide to save the file.
Then run the following command in terminal:

source /etc/profile

2). Configure MySQL

sudo nano /etc/mysql/my.cnf

use down arrow to search for [client]
Add the following line under [client]:

default-character-set = utf8

use down arrow to search for [mysqld]. And just somw lines below, find "bind-address"
Change to the following:

bind-address = 0.0.0.0

close the file by ctrl+x, follow the guide to save the file.
Then run either of the following command in terminal:

sudo service mysql restart
sudo /etc/init.d/mysql restart

3). Configure project config file

cd /opt/project/MultiDBs-Query-Server/MultiDBsQueryServerAPI/src/main/resources
sudo nano config.properties

change the following to correct value:

(e.g. metastore.rest.base = http://54.152.26.131:7654)

metastore.rest.base = (url of metastore project)

What does parameters mean in this file?

"port" is the port you are going to use for the server
"metastore.rest.base" is the base url of metastore project
"metastore.rest.getAllDatasources" is the path after "metastore.rest.base" which will provide all datasources list
"metastore.rest.addDatasource" is the path after "metastore.rest.base" which provides the register restful api
"presto.root" is the root folder of presto server

4). Add priviledge to project folder
(replace the username with your server login username)

cd /opt/
sudo chown -R username:username project


5). Enable start-server and stop-server scripts

cd /opt/project/MultiDBs-Query-Server/
sudo chmod +x ./start-servers.sh
sudo chmod +x ./stop-servers.sh


6). Configure the web client

cd /usr/share/nginx
sudo rm -R html
sudo ln -sv /opt/project/MultiDBs-Query-WebClient html
cd /opt/project/MultiDBs-Query-WebClient/javascripts/knockout_models
sudo nano global.js

change the following to correct value:

(e.g. var restBaseUrl = "http://54.174.80.167:7654/";
var metastoreGetDataSourcesUrl = "http://54.152.26.131:7654/datasources";)

var restBaseUrl = "http://(your ip address):(your server port,default 7654)/";
var metaStoreGetDataSourcesURL = "http://(metastore ip address):(metastore server port,default 7654)/datasources";


5. Build the project by using maven


Run the following:

cd /opt/project/MultiDBs-Utils
mvn install
cd /opt/project/MultiDBs-Query-Server
mvn install


6. launch the server


Run the following:

cd /opt/project/MultiDBs-Query-Server
./start-servers.sh

You can also stop the server by running:
./stop-servers.sh


7. check the web client


Access your server's url by the ip address of your server.