Redis Tutorial Part 1 – Introduction

Redis – Remote Dictionary Server Redis (Remote Dictionary Server) is an opensource key-value store. It can be used as a database, cache and message broker. Redis is an in-memory store which means that it primarily relies on main memory/primary memory for data storage in comparison to other database storages like Mysql that relies on disk storage.   Redis is written in C language and it supports cross-platform. In-memory databases like Redis are faster compared to disk storage databases like Mysql. Redis is a key-value store. Which means that data is stored like name=’John’ The value john an be accessed using the key name. Key value is a string. Redis is single-threaded(One operation at a time) fast and scalable. The speed allows redis to be used as cache memory. Install Redis on Linux sudo apt-get update sudo apt-get install redis-server For Redis server redis-server For Redis Command Line Interface redis-cli To get configuration for redis goto redis-cli.type CONFIG type of configuration to get configuration values in redis.conf.   There are two processes in Redis architecture. REDIS-CLIENT – Manages client interaction REDIS-SERVER – Manages data storage in the memory and forms the major part of the Redis architecture. Single Redis instance can manage multiple redis…

Environment variables and NodeJS Application – Linux
Uncategorized / February 11, 2019

The system environment is primarily the set of variables that define or control certain aspects of process execution. Environment variables help you differentiate between various environments in which your app is running and multiple apps in the environment can access these. Environment variables are system specific and are editable.   Environment variables help you to run your Node.js code in different environments like local/production/development systems. Various environments that we come across are local – Your local machine  environment sit – system integration testing environment uat – user acceptance testing environment development – Your development machine environment production environment staging environment   LINUX Method 1 To set environment variable use code

See your environment variables in Linux

This command displays environment variables Example output

  Now access environment variables inside Node.js code

Gives output as local the above code gives local as your environment Method 2 Accessing environment variables in Node.js is supported as a default. When your Node.js process starts it will automatically provide access to all existing environment variables.

(app.js is your entry file)

Gives output as local Method 3 using dotenv module

  Require this module using

Now create .env file in the application root…

Share this page in social media platforms