
A repository for solving, coding and sharing.
-   
    
  Performance is foremost in this architecture and so duplication of data is nessary. By Product IDThe following is a simple product table used to lookup products by their product_id. cqlsh> CREATE TABLE product (product_id text, name text, description text, asset text, category text, PRIMARY KEY((product_id))); Populate with data: cqlsh> UPDATE product SET name = 'Hammer', description = 'For nails', category = 'Tool' WHERE product_id = 'T112233'; Select a product: cqlsh> SELECT * FROM product WHERE product_id = 'T112244'; By CategoryWe duplicate our data into another table with optimized promary key and column clustering. cqlsh> CREATE TABLE product_by_category ( product_id text, name text, description text, asset text, category text, PRIMARY KEY((category), product_id, name)) WITH CLUSTERING ORDER BY (product_id ASC, name ASC); cqlsh> UPDATE product_by_category SET description = 'For nails' WHERE product_id = 'T112233' AND category = 'Tool' AND name = 'Hammer'; cqlsh> UPDATE product_by_category SET description = 'For hammers' WHERE product_id = 'T112244' AND category = 'Hardware' AND name = 'Nails'; 
-   
    
  Install Java 8$ sudo yum install java-1.8.0-openjdk Add DataStax Repo for Apache Cassandra$ sudo vi /etc/yum.repos.d/datastax.repo Add the following lines to the new file: [datastax-ddc] name = DataStax Repo for Apache Cassandra baseurl = http://rpm.datastax.com/datastax-ddc/3.9 enabled = 1 gpgcheck = 0 Save the file above and run: $ sudo yum install datastax-ddc $ sudo service cassandra start $ sudo nodetool status Add Python 2.7$ cd /usr/src $ sudo wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz $ sudo tar -xvzf Python-2.7.6.tgz $ cd Python-2.7.6 $ sudo ./configure --prefix=/usr/local $ sudo make $ sudo make install Fix python libs: $ cd /usr/lib/python2.7/ $ sudo mv site-packages/* /usr/local/lib/python2.7/site-packages/ $ sudo rm -R site-packages $ sudo ln -s /usr/local/lib/python2.7/site-packages ./ There should now be a symlink in /usr/lib/python2.7 that points site-packages to /usr/local/lib/python2.7/site-packages. site-packages -> /usr/local/lib/python2.7/site-packages In the /usr/local/lib/python2.7/site-packages you should see a cqlshlib folder. Run cqlsh# cqlsh # cqlsh> DESCRIBE keyspaces;