How to configure redis cache in Magento2 using the Unix Socket

Redis cache can be configured in two ways.

  1. Configure caching by editing the file env.php
  2. Using the CLI tool

For Example

Redis Cache is running in the following sock  /var/run/redis-multi.redis/redis.sock

Configure caching by editing the file env.php

Below lines needs to add in env.php file.

‘cache’ => [
‘frontend’ => [
‘default’ => [
‘id_prefix’ => ‘8ad_’,
‘backend’ => ‘Cm_Cache_Backend_Redis’,
‘backend_options’ => [
‘server’ => ‘/var/run/redis-multi.redis/redis.sock’,
‘database’ => ‘0’,
‘port’ => ‘0’,
‘password’ => ”
‘page_cache’ => [
‘id_prefix’ => ‘8ad_’,
‘backend’ => ‘Cm_Cache_Backend_Redis’,
‘backend_options’ => [
‘server’ => ‘/var/run/redis-multi.redis/redis.sock’,
‘database’ => ‘1’,
‘port’ => ‘0’,
‘compress_data’ => ‘0’,
‘password’ => ”

Using CLI tool

Below are commands which we used to configure the redis cache in Magento2


php bin/magento setup:config:set –cache-backend=redis –cache-backend-redis-server=/var/run/redis-multi.redis/redis.sock –cache-backend-redis-db=0 –cache-backend-redis-port=0;


php bin/magento setup:config:set –page-cache=redis –page-cache-redis-server=/var/run/redis-multi.redis/redis.sock –page-cache-redis-db=1 –page-cache-redis-port=0;

Continue Reading

Magento 2 Few important Tools

Reference :

Continue Reading

Data Migration from Magento 1.X to Magento 2.X

Data Migration tool officially released by Magento for Community editions. For Enterprise edition only Partners can get the data migration tool.

There is few rules for successful migration.

  • Don’t make any changes in Magento 1 admin except order Management.
  • Stop all cron jobs in Magento 1
  • Don’t alter any code
  • Don’t make changes in Magento2 admin and storefront.

Supported Versions
Following version are supported for Migration

  • Community Edition (CE) version 1.6.x, 1.7.x, 1.8.x, 1.9.x
  • Enterprise Edition (EE) version 1.11.x, 1.12.x, 1.13.x, 1.14.x

Terminology in Migration Tool.
There are lot of differences in the structure and format of data between Magento 1 and Magento 2. In Map all those are declared. When the differences are not mentioned in Map, then we will get errors in data migration processing.
Map – set of rules that describe connections between Magento 1.x and Magento 2.0 data structures
Mode – Mode of operation in Data Migration through basic commands.

  • Settings – Migrates all possible configuration settings from 1.x to 2.x
  • Data – Bulk migrates data from your Magento 1 DB to your Magento 2 DB
  • Delta – Incremental “catch-up” migration after the initial bulk data migration

Migration Plan

  • STEP 1: Review your current site (Extensions and Modules)
  • STEP 2: Capacity Planning (Servers)
  • STEP 3: Build and Test the Magento 2
  • STEP 4: Start Your Migration
  • STEP 5: Incremental Updates
  • STEP 6: Go Live

Install new Magento 2 environment in the server.
Stop Magento2 cron Jobs
Backup the Magento 2 database.
Check the data migration access to both Magento 1 and Magento 2 databases.

Installation, Configuration and Mapping
Data Migration tool is not an extension, it is shell app which requires Magento2 Framework to work. We can get data migration tool from git hub only for community edition.

Install from Github

  • composer config git
  • composer require magento/data-migration-tool:dev-master
    After installation, the following directory contains mapping and configuration file
  • <your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/ce-to-ce


  • Choose the right folder based on the Magento versions.
  • Copy the config.xml.dist to config.xml

<source>    <database host=”″ name=”magento11302″ user=”root” password=”pass”/></source><destination>    <database host=”″ name=”magento2″ user=”root” password=”pass”/></destination><options>     <crypt_key>f3e25abe619dae2387df9fs594f01985</crypt_key></options>

  • Source – Database details and its credentials of Magento 1.X,
  • Destination – Database Details and it credentials of Magento 2.X
  • crypt_key – Encryption key from Magento 1.X (local.xml).

Mapping Files
Data Migration tools uses mapping file to enable us to perform custom mapping between Magento 1 and Magento 2 which including changes in table name and field name, ignoring tables and fields and Transferring the table / field.
Following picture is an example of Map configuration file

MAP Steps

  • Based on the Configuration file chosen, copy the map.xml.dist to map.xml
  • Make necessary changes in Config.xml
  • Transferring most of data from Magento 1 to Magento 2
  • This step reads instructions from map.xml


  • Source – contains rules of source database
  • Destination – contains rules of destination database


  • ignore – document, field or data type marked with this option will be ignored
  • rename – describes name relations between documents with the different name. In a case when destination document name is not the same with the source document – you can use rename option to set source document name similar to destination table name
  • move – sets rule to move specified field from source document to destination document. NOTE: destination document name should be the same with the source document name. If source and destination document names are
  • different – you need to use rename option for document that contains moved field
  • transform – is a option that allows user to migrate fields according to behavior described in handlers
  • handler – describes transformation behavior for fields. To call the handler you need to specify

Run the Data Migration Tool
bin/magento migrate: [-r|–reset] {}
– settings / data / delta.

The Data Migration Tool saves its current progress as it runs. If errors or user intervention stop it from running, the Data Migration Tool resumes progress at the last known good state.

Manual Migration (Media, Storefront design and ACLs)


All media files (for example, images for products, categories, the WYSIWYG editor, and so on) should be copied manually from /media to /pub/media.
However, do not copy .htaccess files located in the Magento 1 media folder.
Magento 2 has its own .htaccess that should be preserved.

Storefront Design

  • Design in files (css, js, templates, XML layouts) changed its location and format
  • Layout Updates stored in database. Placed through Magento 1 Admin in CMS Pages, CMS Widgets, Category Pages and Product Pages

ACLs (Access Control Lists)

  • You must manually re-create all credentials for web services APIs (that is, SOAP, XML-RPC, and REST)
  • You must manually re-create all administrative users and associate them with access privileges

After Migration
Start Magento 2 CRON jobs
Flush all Magento 2 cache types

  • magento cache:status
  • magento cache:enable [type] … [type]
  • magento cache:disable [type] … [type]
  • magento cache:disable db_ddl full_page
  • magento cache:clean [type] … [type]
  • magento cache:flush [type] … [type]
  • magento cache:flush –all

Re-index all Magento 2 indexers

  • magento indexer:info
  • magento indexer:status [indexer]
  • magento indexer:reindex [indexer]


Continue Reading

Cache Mechanism in Magento

Cache plays main role in magento. Magento has two levels of cache.

  1. A Fast level
  2. A Slow level

There are various type of  caching are available like FileSystem , APC, Memcache and Redis cache.


Cache and fullpage caches are maintained in  filesystem, for storage we can use SSD Hardisk can be used, which we can read the files faster. This is only useful to smail Buisness with low traffic.


Alternative PHP Cache is free opcode cache for PHP. It is optimize the PHP intermediate code

APC PHP Module will not speed up the module, instead of that its eliminates the delay caused by Magento PHP .tags are not supported. Slow level cache is needed


Memcache is a high performance , distributed memory object caching system, generic in nature, this is the very fast cache backend without tags..

Tags are not supported. Slow level cache is needed


redis cache store advanced key-store with full cache tag support.

Very Fast cache backend with fully tag support , No Slow level  cache is needed.

Depends on buisness  we can choose  cache mechanism, suppose if it is small buisness , then we can have the APC with second level cache as filesystem.

Redis cache will be the perfect solutions for multiple server environment and large buisness.

Continue Reading

Magento Frontend Validation Classes

Magento handling the validation by extenal javascript( validation.js). we need to write the form field values has been assinged.

Below are the validation rules(class names) and their error messages.

‘validate-no-html-tags’ => ‘HTML tags are not allowed’
‘validate-select’ => ‘Please select an option.’
‘required-entry’ => ‘This is a required field.’
‘validate-number’ => ‘Please enter a valid number in this field.’
‘validate-number-range’ => ‘The value is not within the specified range.’
‘validate-digits’ => ‘Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.’
‘validate-digits-range’ => ‘The value is not within the specified range.’
‘validate-alpha’ => ‘Please use letters only (a-z or A-Z) in this field.’
‘validate-code’ => ‘Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.’
‘validate-alphanum’ => ‘Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.’
‘validate-alphanum-with-spaces’ => ‘Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.’
‘validate-street’ => ‘Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.’
‘validate-phoneStrict’ => ‘Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.’
‘validate-phoneLax’ => ‘Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.’
‘validate-fax’ => ‘Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.’
‘validate-date’ => ‘Please enter a valid date.’
‘validate-date-range’ => ‘The From Date value should be less than or equal to the To Date value.’
‘validate-email’ => ‘Please enter a valid email address. For example’
‘validate-emailSender’ => ‘Please use only visible characters and spaces.’
‘validate-password’ => ‘Please enter 6 or more characters. Leading or trailing spaces will be ignored.’
‘validate-admin-password’ => ‘Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.’
‘validate-both-passwords’ => ‘Please make sure your passwords match.’
‘validate-url’ => ‘Please enter a valid URL. Protocol is required (http://, https:// or ftp://)’
‘validate-clean-url’ => ‘Please enter a valid URL. For example or’
‘validate-identifier’ => ‘Please enter a valid URL Key. For example “example-page”, “example-page.html” or “anotherlevel/example-page”.’
‘validate-xml-identifier’ => ‘Please enter a valid XML-identifier. For example something_5, block5, id-3.’
‘validate-ssn’ => ‘Please enter a valid social security number. For example 469-58-9875.’
‘validate-zip’ => ‘Please enter a valid zip code. For example 90605 or 90602-1234.’
‘validate-zip-international’ => ‘Please enter a valid zip code.’
‘validate-date-au’ => ‘Please use this date format: dd/mm/yyyy. For example 17/03/2010 for the 17th of March, 2010.’
‘validate-currency-dollar’ => ‘Please enter a valid $ amount. For example $200.00.’
‘validate-one-required’ => ‘Please select one of the above options.’
‘validate-one-required-by-name’ => ‘Please select one of the options.’
‘validate-not-negative-number’ => ‘Please enter a number 0 or greater in this field.’
‘validate-zero-or-greater’ => ‘Please enter a number 0 or greater in this field.’
‘validate-greater-than-zero’ => ‘Please enter a number greater than 0 in this field.’
‘validate-state’ => ‘Please select State/Province.’
‘validate-new-password’ => ‘Please enter 6 or more characters. Leading or trailing spaces will be ignored.’
‘validate-cc-number’ => ‘Please enter a valid credit card number.’
‘validate-cc-type’ => ‘Credit card number does not match credit card type.’
‘validate-cc-type-select’ => ‘Card type does not match credit card number.’
‘validate-cc-exp’ => ‘Incorrect credit card expiration date.’
‘validate-cc-cvn’ => ‘Please enter a valid credit card verification number.’
‘validate-ajax’ => ”
‘validate-data’ => ‘Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.’
‘validate-css-length’ => ‘Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.’
‘validate-length’ => ‘Text length does not satisfy specified text range.’
‘validate-percents’ => ‘Please enter a number lower than 100.’
‘validate-cc-ukss’ => ‘Please enter issue number or start date for switch/solo card type.’

Continue Reading

GIT (Version Control System)

What is Version Control?


Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more.

Local Version Control Systems
Many people’s version-control method of choice is to copy files into another directory
It is easy to forget which directory you’re in and accidentally write to the wrong file or copy over files you don’t mean to.
To deal with this issue, programmers long ago developed local VCSs that had a simple database that kept all the changes to files under revision control.
One of the more popular VCS tools was a system called RCS
RCS works by keeping patch sets (that is, the differences between files) in a special format on disk; it can then re-create what any file looked like at any point in time by adding up all the patches.

Centralized Version Control Systems

Need to collaborate with developers on other systems.
Centralized Version Control Systems (CVCSs) were developed. These systems, such as CVS, Subversion.
For many years, this has been the standard for version control.
 Administrators have fine-grained control over who can do what; and it’s far easier to administer a CVCS than it is to deal with local databases on every client.
This setup also has some serious downsides. The most obvious is the single point of failure that the centralized server represents.
Server goes down for an hour
 If the hard disk the central database is on becomes corrupted, and proper backups haven’t been kept

Distributed Version Control Systems

In a DVCS (such as Git), clients don’t just check out the latest snapshot of the files: they fully mirror the repository.
Thus if any server dies, and these systems were collaborating via it, any of the client repositories can be copied back up to the server to restore it.
Every clone is really a full backup of all the data.


Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is a version control system that is used for software development and other version control tasks. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows. Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development.

Some of the goals of the new system were as follows:
Simple design
Strong support for non-linear development (thousands of parallel branches)
Fully distributed
Able to handle large projects like the Linux kernel efficiently (speed and data size)

Continue Reading