Search This Blog

Showing posts with label nosql. Show all posts
Showing posts with label nosql. Show all posts

Tuesday, November 28, 2017

Cassandra Group By clause in Select command

1. Go to C:\Program Files\DataStax-DDC\apache-cassandra\conf\cassandra.yaml
change false to true

enable_user_defined_functions: true


2. Paste below functions in cqlsh window

CREATE OR REPLACE FUNCTION state_group_and_count( state map, type text )
CALLED ON NULL INPUT
RETURNS map
LANGUAGE java AS '
Integer count = (Integer) state.get(type);  if (count == null) count = 1; else count++; state.put(type, count); return state; ' ;

CREATE OR REPLACE AGGREGATE group_and_count(text)
SFUNC state_group_and_count
STYPE map 
INITCOND {};


3. execute the query like below

--select group_and_count(column) from table;
-- ex
-- select group_and_count(item) from skutable;



4. you may see like this 
Failed to format value OrderedMapSerializedKey([(u'xxx', 4)]) : 'NoneType' object has no attribute 'sub_types'
this is a cqlsh error. so you can try from programming languages like java..., it may work perfectly.

Thursday, February 4, 2016

linux Ubuntu Postgresql Setup Installation


Type the below commands.


postgresql
**********

    sudo apt-get install postgresql postgresql-contrib
    apt-cache search postgres
    sudo apt-get install pgadmin3


create default user/role postgres
**********************************
    sudo -u postgres psql postgres
    \password postgres
    p0stgr3s
    p0stgr3s

linux Ubuntu SVN Setup Installation

svn
***
Type the below commands.
**********************

    sudo apt-get install subversion apache2 libapache2-svn

checkout
********
    svn co --username vijay svn://182.71.255.164/svn/repos/FastRaq/trunk/3.Implementation/Code/middleware
    enter pwd

Wednesday, February 3, 2016

linux Ubuntu Maven Setup Installation


Maven
*****

Type the below commands.

    sudo apt-get install maven
    sudo update-alternatives --config mvn

linux Ubuntu JDK Java Setup Installation

java 1.8
*******


Type the below commands.

    Installing Java 8
        $ sudo add-apt-repository ppa:webupd8team/java
        $ sudo apt-get update
        $ sudo apt-get install oracle-java8-installer
    Verify java
        $ java -version
    Configuring Java Environment
        $ sudo apt-get install oracle-java8-set-default


linux Ubuntu Git Setup Installation

Git
***
Type the below commands.

    sudo apt-get install git-core
    git clone https://github.com/ebhaiah/middleware-soa.git

Linux - Ubuntu - Mongodb Installation Setup



mongodb
*******


1.    Install MongoDB
    Import the public key used by the package management system.

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

2Create a list file for MongoDB.

    echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

3 Reload local package database.

    sudo apt-get update

4 Install the MongoDB packages.

    sudo apt-get install -y mongodb-org

4.1 Install a specific release of MongoDB.

    sudo apt-get install -y mongodb-org=3.0.7 mongodb-org-server=3.0.7 mongodb-org-shell=3.0.7 mongodb-org-mongos=3.0.7 mongodb-org-tools=3.0.7

5. Start MongoDB.

    sudo service mongod start

5.1 Verify that MongoDB has started successfully
    Verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading

6 Stop MongoDB.

    sudo service mongod stop

7 Restart MongoDB.
   
    sudo service mongod restart

8. mongodb - uninstall

    sudo service mongod stop
    sudo apt-get purge mongodb-org*
    sudo rm -r /var/log/mongodb
    sudo rm -r /var/lib/mongodb

Hit Counter


View My Stats