Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PostgreNoSQL] Added NoSQL support for PostgreSQL. #1242

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ addons:
hosts:
- myshorthost
hostname: myshorthost
postgresql: "9.5"

install: mvn install -q -DskipTests=true

script: mvn test -q

before_script:
- psql -c 'CREATE database test;' -U postgres
- psql -c 'CREATE TABLE usertable (YCSB_KEY VARCHAR(255) PRIMARY KEY not NULL, YCSB_VALUE JSONB not NULL);' -U postgres -d test
- psql -c 'GRANT ALL PRIVILEGES ON DATABASE test to postgres;' -U postgres


# Services to start for tests.
services:
- ignite
- mongodb
- postgresql
# temporarily disable riak. failing, docs offline.
# - riak

Expand Down
1 change: 1 addition & 0 deletions bin/bindings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ mongodb:com.yahoo.ycsb.db.MongoDbClient
mongodb-async:com.yahoo.ycsb.db.AsyncMongoDbClient
nosqldb:com.yahoo.ycsb.db.NoSqlDbClient
orientdb:com.yahoo.ycsb.db.OrientDBClient
postgrenosql:com.yahoo.ycsb.postgrenosql.PostgreNoSQLDBClient
rados:com.yahoo.ycsb.db.RadosClient
redis:com.yahoo.ycsb.db.RedisClient
rest:com.yahoo.ycsb.webservice.rest.RestClient
Expand Down
1 change: 1 addition & 0 deletions bin/ycsb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ DATABASES = {
"mongodb-async": "com.yahoo.ycsb.db.AsyncMongoDbClient",
"nosqldb" : "com.yahoo.ycsb.db.NoSqlDbClient",
"orientdb" : "com.yahoo.ycsb.db.OrientDBClient",
"postgrenosql" : "com.yahoo.ycsb.postgrenosql.PostgreNoSQLDBClient",
"rados" : "com.yahoo.ycsb.db.RadosClient",
"redis" : "com.yahoo.ycsb.db.RedisClient",
"rest" : "com.yahoo.ycsb.webservice.rest.RestClient",
Expand Down
5 changes: 5 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ LICENSE file.
<artifactId>orientdb-binding</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>postgrenosql-binding</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>rados-binding</artifactId>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ LICENSE file.
<module>mongodb</module>
<module>nosqldb</module>
<module>orientdb</module>
<module>postgrenosql</module>
<module>rados</module>
<module>redis</module>
<module>rest</module>
Expand Down
64 changes: 64 additions & 0 deletions postgrenosql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!--
Copyright (c) 2017 YCSB contributors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You
may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License. See accompanying
LICENSE file.
-->

## Quick Start
This section describes how to run YCSB on PostgreSQL and use it as a document store.

## Download and Install Postgres Server Version
You can find an instruction here: https://www.postgresql.org/download/.
Otherwise download the official docker container from https://hub.docker.com/_/postgres/ and follow the instructions.
Do not forget to expose the postgresql server port when running the container.
The YCSB PostgreNoSQL is tested on PostgreSQL Server 9.5 and 9.6.

In the next step grant access rights for the default postgres user to access the Postgres Server.
In case you run the YCSB client and the Postgres Server on different machines make sure that the server is reachable.
Then create a database, e.g., test and create a table that is able to store the documents.

The following commands can be used for that:

**CREATE DATABASE test;**

**CREATE TABLE usertable (YCSB_KEY VARCHAR(255) PRIMARY KEY not NULL, YCSB_VALUE JSONB not NULL);**

**GRANT ALL PRIVILEGES ON DATABASE test to postgres;**

## Configure the parameters in the properties file
**postgrenosql.url = jdbc:postgresql://localhost:5432/test**

Defines the connection string to the Postgres Server. Replace localhost by the address of your Postgres Server, 5432 by the port your Server is listing to and test by the name of your database.

**postgrenosql.user = postgres**

Defines the username the client uses to connect to the Postgres Server.

**postgrenosql.passwd = postgres**

Defines the password of user the client uses to connect to the Postgres Server.

**postgrenosql.autocommit = true**

Defines whether transactions shoud by applied directly.

Here are some basic commands to start the benchmark from the root directory:

The following command loads the workload and uses the configuration defined in the properties file:
.\bin\ycsb load postgrenosql -P .\workloads\workloada -P .\postgrenosql\conf\postgrenosql.properties

The following command runs the workload and uses the configuration defined in the properties file:
.\bin\ycsb run postgrenosql -P .\workloads\workloada -P .\postgrenosql\conf\postgrenosql.properties


4 changes: 4 additions & 0 deletions postgrenosql/conf/postgrenosql.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
postgrenosql.url = jdbc:postgresql://localhost:5432/test
postgrenosql.user = postgres
postgrenosql.passwd = postgres
postgrenosql.autocommit = true
66 changes: 66 additions & 0 deletions postgrenosql/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!--
Copyright (c) 2012 - 2015 YCSB contributors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You
may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License. See accompanying
LICENSE file.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>binding-parent</artifactId>
<version>0.16.0-SNAPSHOT</version>
<relativePath>../binding-parent</relativePath>
</parent>

<artifactId>postgrenosql-binding</artifactId>
<name>PostgreNoSQL Binding</name>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212.jre7</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.13</version>
</dependency>
</dependencies>

</project>
Loading