Skip to content

Commit

Permalink
[solr,solr6] Add Solr 6 binding
Browse files Browse the repository at this point in the history
  • Loading branch information
risdenk committed Sep 30, 2016
1 parent a13fc48 commit 01b74d0
Show file tree
Hide file tree
Showing 20 changed files with 1,011 additions and 38 deletions.
3 changes: 2 additions & 1 deletion bin/ycsb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ DATABASES = {
"redis" : "com.yahoo.ycsb.db.RedisClient",
"riak" : "com.yahoo.ycsb.db.riak.RiakKVClient",
"s3" : "com.yahoo.ycsb.db.S3Client",
"solr" : "com.yahoo.ycsb.db.SolrClient",
"solr" : "com.yahoo.ycsb.db.solr.SolrClient",
"solr6" : "com.yahoo.ycsb.db.solr6.SolrClient",
"tarantool" : "com.yahoo.ycsb.db.TarantoolClient",
"voldemort" : "com.yahoo.ycsb.db.VoldemortClient"
}
Expand Down
5 changes: 5 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ LICENSE file.
<artifactId>solr-binding</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>solr6-binding</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>tarantool-binding</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ LICENSE file.
<riak.version>2.0.5</riak.version>
<aerospike.version>3.1.2</aerospike.version>
<solr.version>5.4.0</solr.version>
<solr6.version>6.2.0</solr6.version>
<arangodb.version>2.7.3</arangodb.version>
</properties>

Expand Down Expand Up @@ -133,6 +134,7 @@ LICENSE file.
<module>riak</module>
<module>s3</module>
<module>solr</module>
<module>solr6</module>
<module>tarantool</module>
<!--<module>voldemort</module>-->
</modules>
Expand Down
50 changes: 25 additions & 25 deletions solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,35 @@ 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>binding-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../binding-parent</relativePath>
</parent>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>binding-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../binding-parent</relativePath>
</parent>

<artifactId>solr-binding</artifactId>
<name>Solr Binding</name>
<packaging>jar</packaging>
<artifactId>solr-binding</artifactId>
<name>Solr 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.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solr.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solr.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.10</version>
<version>1.7.21</version>
</dependency>

<dependency>
Expand All @@ -55,5 +55,5 @@ LICENSE file.
<version>${solr.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* LICENSE file.
*/

package com.yahoo.ycsb.db;
package com.yahoo.ycsb.db.solr;

import com.yahoo.ycsb.ByteIterator;
import com.yahoo.ycsb.DB;
Expand All @@ -34,12 +34,8 @@
import org.apache.solr.common.SolrInputDocument;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.*;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.Vector;

/**
* Solr client for YCSB framework.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
* The YCSB binding for
* <a href="http://lucene.apache.org/solr/">Solr</a>.
*/
package com.yahoo.ycsb.db;
package com.yahoo.ycsb.db.solr;

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* LICENSE file.
*/

package com.yahoo.ycsb.db;
package com.yahoo.ycsb.db.solr;

import com.yahoo.ycsb.ByteIterator;
import com.yahoo.ycsb.DB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.yahoo.ycsb.db;
package com.yahoo.ycsb.db.solr;

import com.yahoo.ycsb.DB;
import org.junit.After;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.yahoo.ycsb.db;
package com.yahoo.ycsb.db.solr;

import com.yahoo.ycsb.DB;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.junit.After;

import java.net.URL;
import java.util.Properties;
import java.util.Set;

import static org.junit.Assume.assumeNoException;

Expand Down
110 changes: 110 additions & 0 deletions solr6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<!--
Copyright (c) 2016 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 Solr running locally.

### 1. Set Up YCSB

Clone the YCSB git repository and compile:

git clone git://github.com/brianfrankcooper/YCSB.git
cd YCSB
mvn -pl com.yahoo.ycsb:solr6-binding -am clean package

### 2. Set Up Solr

There must be a running Solr instance with a core/collection pre-defined and configured.
- See this [API](https://cwiki.apache.org/confluence/display/solr/CoreAdmin+API#CoreAdminAPI-CREATE) reference on how to create a core.
- See this [API](https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api1) reference on how to create a collection in SolrCloud mode.

The `conf/schema.xml` configuration file present in the core/collection just created must be configured to handle the expected field names during benchmarking.
Below illustrates a sample from a schema config file that matches the default field names used by the ycsb client:

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="field0" type="text_general" indexed="true" stored="true"/>
<field name="field1" type="text_general" indexed="true" stored="true"/>
<field name="field2" type="text_general" indexed="true" stored="true"/>
<field name="field3" type="text_general" indexed="true" stored="true"/>
<field name="field4" type="text_general" indexed="true" stored="true"/>
<field name="field5" type="text_general" indexed="true" stored="true"/>
<field name="field6" type="text_general" indexed="true" stored="true"/>
<field name="field7" type="text_general" indexed="true" stored="true"/>
<field name="field8" type="text_general" indexed="true" stored="true"/>
<field name="field9" type="text_general" indexed="true" stored="true"/>

If running in SolrCloud mode ensure there is an external Zookeeper cluster running.
- See [here](https://cwiki.apache.org/confluence/display/solr/Setting+Up+an+External+ZooKeeper+Ensemble) for details on how to set up an external Zookeeper cluster.
- See [here](https://cwiki.apache.org/confluence/display/solr/Using+ZooKeeper+to+Manage+Configuration+Files) for instructions on how to use Zookeeper to manage your core/collection configuration files.

### 3. Run YCSB

Now you are ready to run! First, load the data:

./bin/ycsb load solr6 -s -P workloads/workloada -p table=<core/collection name>

Then, run the workload:

./bin/ycsb run solr6 -s -P workloads/workloada -p table=<core/collection name>

For further configuration see below:

### Default Configuration Parameters
The default settings for the Solr node that is created is as follows:

- `solr.cloud`
- A Boolean value indicating if Solr is running in SolrCloud mode. If so there must be an external Zookeeper cluster running also.
- Default value is `false` and therefore expects solr to be running in stand-alone mode.

- `solr.base.url`
- The base URL in which to interface with a running Solr instance in stand-alone mode
- Default value is `http://localhost:8983/solr

- `solr.commit.within.time`
- The max time in ms to wait for a commit when in batch mode, ignored otherwise
- Default value is `1000ms`

- `solr.batch.mode`
- Indicates if inserts/updates/deletes should be commited in batches (frequency controlled by the `solr.commit.within.time` parameter) or commit 1 document at a time.
- Default value is `false`

- `solr.zookeeper.hosts`
- A list of comma seperated host:port pairs of Zookeeper nodes used to manage SolrCloud configurations.
- Must be passed when in [SolrCloud](https://cwiki.apache.org/confluence/display/solr/SolrCloud) mode.
- Default value is `localhost:2181`

### Custom Configuration
If you wish to customize the settings used to create the Solr node
you can created a new property file that contains your desired Solr
node settings and pass it in via the parameter to 'bin/ycsb' script. Note that
the default properties will be kept if you don't explicitly overwrite them.

Assuming that we have a properties file named "myproperties.data" that contains
custom Solr node configuration you can execute the following to
pass it into the Solr client:

./bin/ycsb run solr6 -P workloads/workloada -P myproperties.data -s

If you wish to use SolrCloud mode ensure a Solr cluster is running with an
external zookeeper cluster and an appropriate collection has been created.
Make sure to pass the following properties as parameters to 'bin/ycsb' script.

solr.cloud=true
solr.zookeeper.hosts=<zkHost2>:<zkPort1>,...,<zkHostN>:<zkPortN>


79 changes: 79 additions & 0 deletions solr6/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012 - 2016 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>binding-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../binding-parent</relativePath>
</parent>

<artifactId>solr6-binding</artifactId>
<name>Solr 6 Binding</name>
<packaging>jar</packaging>

<properties>
<!-- Skip tests by default. will be activated by jdk8 profile -->
<skipTests>true</skipTests>
</properties>

<dependencies>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solr6.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>

<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-test-framework</artifactId>
<version>${solr6.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<!-- Solr 6+ requires JDK8 to run, so none of our tests
will work unless we're using jdk8.
-->
<profile>
<id>jdk8-tests</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<skipTests>false</skipTests>
</properties>
</profile>
</profiles>
</project>
Loading

0 comments on commit 01b74d0

Please sign in to comment.