1.
MongoDB
AIM:
To install and configure MongoDB and execute NoSQL commands
for CRUD operations.
Algorithm:
1. Install MongoDB.
2. Start the MongoDB service.
3. Access Mongo shell.
4. Create database & collection.
5. Insert, update, read, delete documents.
6. Exit shell.
Installation (Ubuntu):
bash
CopyEdit
sudo apt update
sudo apt install -y mongodb
sudo systemctl start mongodb
sudo systemctl enable mongodb
Execute MongoDB Commands:
bash
CopyEdit
mongo
> use studentDB
> db.students.insertOne({name: "Alice", marks: 87})
> db.students.insertOne({name: "Bob", marks: 92})
> db.students.find()
> db.students.updateOne({name: "Bob"}, {$set: {marks: 95}})
> db.students.deleteOne({name: "Alice"})
Sample Output:
json
CopyEdit
{ "_id" : ObjectId(...), "name" : "Bob", "marks" : 95 }
Result:
MongoDB was successfully installed, and basic NoSQL operations
were performed using Mongo shell.
2. Apache Cassandra
AIM:
To install and configure Apache Cassandra and execute NoSQL
CQL (Cassandra Query Language) commands.
Algorithm:
1. Start the system and open the terminal.
2. Install Java Development Kit (JDK) if not already installed.
3. Add the Apache Cassandra repository to the system.
4. Import the GPG key for Apache Cassandra.
5. Update the package list using the appropriate command.
6. Install Apache Cassandra using the package manager.
7. Start the Cassandra service and enable it to run on boot.
8. Open the Cassandra Query Language Shell (CQLSH).
9. Create a keyspace using the CREATE KEYSPACE command.
10. Switch to the created keyspace using the USE command.
11. Create a table using the CREATE TABLE command with
appropriate schema.
12. Insert records into the table using the INSERT INTO
command.
13. Retrieve all records from the table using the SELECT
command.
14. Update specific records using the UPDATE command.
15. Delete specific records using the DELETE command.
16. Exit the CQL shell after completing the operations.
Installation (Ubuntu):
bash
CopyEdit
sudo apt update
sudo apt install openjdk-11-jdk -y
echo "deb https://www.apache.org/dist/cassandra/debian 40x main" |
sudo tee /etc/apt/sources.list.d/cassandra.sources.list
curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add
-
sudo apt update
sudo apt install cassandra -y
sudo systemctl start cassandra
✅ Execute Cassandra Commands:
bash
CopyEdit
cqlsh
> CREATE KEYSPACE college WITH replication =
{'class':'SimpleStrategy', 'replication_factor':1};
> USE college;
> CREATE TABLE students(id int PRIMARY KEY, name text,
marks int);
> INSERT INTO students(id, name, marks) VALUES (1, 'Alice', 87);
> INSERT INTO students(id, name, marks) VALUES (2, 'Bob', 92);
> SELECT * FROM students;
> UPDATE students SET marks = 95 WHERE id = 2;
> DELETE FROM students WHERE id = 1;
✅ Sample Output:
pgsql
CopyEdit
id | name | marks
----+-------+-------
2 | Bob | 95
✅ Result:
Cassandra was installed and configured. Basic CQL commands were
executed for managing student data.
3. Apache HBase
AIM: To install and configure Apache HBase and execute HBase
shell commands.
Algorithm:
1. Start the system and open the terminal.
2. Install Java Development Kit (JDK) if not already installed.
3. Download Apache HBase from the official website.
4. Extract the downloaded HBase archive to a desired directory.
5. Set environment variables for HBASE_HOME and update the
system PATH.
6. (Optional) Configure hbase-site.xml for standalone or pseudo-
distributed mode.
7. Start the HBase services using the start-hbase.sh script.
8. Open the HBase shell using the hbase shell command.
9. Create a table using the create command with a column family.
10. Insert data into the table using the put command.
11. Retrieve data from the table using the scan command.
12. Delete a specific column or row using the delete
command.
13. Disable the table using the disable command before
deletion.
14. Drop the table using the drop command.
15. Exit the HBase shell after completing the operations.
Installation (Standalone):
bash
CopyEdit
# Prerequisite: Java and Hadoop
sudo apt update
sudo apt install openjdk-11-jdk -y
wget https://downloads.apache.org/hbase/2.4.17/hbase-2.4.17-
bin.tar.gz
tar -xvzf hbase-2.4.17-bin.tar.gz
cd hbase-2.4.17
# Set env
export HBASE_HOME=$(pwd)
export PATH=$HBASE_HOME/bin:$PATH
Execute HBase Shell Commands:
bash
CopyEdit
bin/start-hbase.sh
hbase shell
> create 'students', 'info'
> put 'students', 'row1', 'info:name', 'Alice'
> put 'students', 'row1', 'info:marks', '87'
> put 'students', 'row2', 'info:name', 'Bob'
> put 'students', 'row2', 'info:marks', '92'
> scan 'students'
> delete 'students', 'row1', 'info:marks'
> disable 'students'
> drop 'students'
Sample Output:
pgsql
CopyEdit
ROW COLUMN+CELL
row1 column=info:name, value=Alice
row1 column=info:marks, value=87
Result:
HBase was successfully installed and used to perform NoSQL
operations using HBase shell.
4. Hypertable Installation
✅ AIM:
To install and configure Hypertable with Hadoop HDFS backend
and execute NoSQL commands using HQL.
✅ Algorithm:
1. Install Java on your system.
2. Install and configure Apache Hadoop in standalone or pseudo-
distributed mode.
3. Verify that Hadoop and HDFS services are running correctly.
4. Download and extract the Hypertable binary.
5. Configure Hypertable to use HDFS as its storage backend via
hypertable.cfg.
6. Set required environment variables (HYPERTABLE_HOME,
JAVA_HOME, etc.).
7. Start Hadoop services (start-dfs.sh and start-yarn.sh).
8. Start Hypertable using start-all.sh.
9. Open the Hypertable shell using ht shell.
10. Execute basic NoSQL commands (create, insert, select,
delete, drop).
✅ Installation Steps:
🔹 Step 1: Install Java
sudo apt update
sudo apt install -y openjdk-11-jdk
🔹 Step 2: Install Hadoop
Download Hadoop:
wget
https://downloads.apache.org/hadoop/common/hadoop-3.3.6/hadoop-
3.3.6.tar.gz
tar -xvzf hadoop-3.3.6.tar.gz
mv hadoop-3.3.6 /usr/local/hadoop
Set environment variables in ~/.bashrc:
export HADOOP_HOME=/usr/local/hadoop
export
PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
Source your bash config:
source ~/.bashrc
Format the namenode:
hdfs namenode -format
Start Hadoop services:
start-dfs.sh
start-yarn.sh
🔹 Step 3: Install Hypertable
wget
https://github.com/hypertable/hypertable/releases/download/0.9.8.12/
hypertable-0.9.8.12-linux-x86_64.tar.gz
tar -xvzf hypertable-0.9.8.12-linux-x86_64.tar.gz
cd hypertable-0.9.8.12
🔹 Step 4: Configure Hypertable to Use HDFS
Edit the file conf/hypertable.cfg:
vim conf/hypertable.cfg
Add or modify:
Storage=Hadoop
Hadoop.FS.default.name=hdfs://localhost:9000
🔹 Step 5: Set Hypertable Environment
export HYPERTABLE_HOME=$(pwd)
export PATH=$HYPERTABLE_HOME/bin:$PATH
🔹 Step 6: Start Hypertable
bin/start-all.sh
🔹 Step 7: Open HQL Shell
bin/ht shell
🔹 Step 8: Run NoSQL Commands
create table students (info);
insert into students (row1) values ("info:name" => "Alice",
"info:mark" => "85");
select * from students;
Result:
Hypertable was successfully installed and configured to use Hadoop
HDFS as the backend storage, and NoSQL operations were executed
through the HQL shell.