Skip to content

Commit

Permalink
New Amazon scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
simonambridge committed Jun 6, 2016
1 parent a3753b6 commit aa05de3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions create_core.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#Simple script to create solr cores and reload/index with the right XML's
if [ $# -eq 0 ]
then
echo "No arguments supplied"
echo "./create_core.sh <name of your keyspace>"
exit 1
fi

#add the path to dsetool if dsetool is not in your path
echo 'Creating Solr cores...'
dsetool create_core amazon.metadata schema=schema_metadata.xml solrconfig=solr_config_metadata.xml reindex=true
dsetool create_core amazon.rank schema=schema_rank.xml solrconfig=solr_config_rank.xml reindex=true
dsetool create_core amazon.clicks schema=schema_clicks.xml solrconfig=solr_config_clicks.xml reindex=true
dsetool create_core $1.metadata schema=schema_metadata.xml solrconfig=solr_config_metadata.xml reindex=true
dsetool create_core $1.rank schema=schema_rank.xml solrconfig=solr_config_rank.xml reindex=true
dsetool create_core $1.clicks schema=schema_clicks.xml solrconfig=solr_config_clicks.xml reindex=true
echo 'finished creating Solr cores!'
8 changes: 8 additions & 0 deletions create_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if [ $# -eq 0 ]
then
echo "No arguments supplied"
echo "./create_database <name of your keyspace>"
exit 1
fi
python ./solr_dataloader.py $1

3 changes: 2 additions & 1 deletion solr_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from cassandra.cluster import Cluster

KEYSPACE = "amazon"
KEYSPACE = sys.argv[1]
META_COLUMN_FAMILY = "metadata"
RANK_COLUMN_FAMILY = "rank"
GEO_COLUMN_FAMILY = "clicks"
Expand Down Expand Up @@ -194,6 +194,7 @@ def load_geo_data(session, geopath):

meta_prepared = session.prepare(META_INSERT_STATEMENT)
rank_prepared = session.prepare(RANK_INSERT_STATEMENT)
print ('Loading into Keyspace',sys.argv[1])
print ('loading geo')
load_geo_data(session, geo_path)
print ('loading meta')
Expand Down

0 comments on commit aa05de3

Please sign in to comment.