skip to Main Content

I have Magento CE 2.4.6 running on a Ubuntu server with Elasticsearch 8.11.4. For a mandatory module I absolutely need, I need to downgrade to ES 7.9.3.

I read everywhere it was not possible to downgrade ES. Is there a way to uninstall ES 8.4.11 and install ES 7.9.3 without damaging the system? If yes, how?

(I don’t want to make any mistakes)

2

Answers


  1. The upgrade from 7.x to 8.x creates changes in indices and configurations that are not easy revesible.
    Suggestion: build a test 7.x cluster and add the snapshot repositroy from 8.x as READ-ONLY. Import your indices one by one and test to see if you can still use them or what changes are necessary so you can revert them to 7.x . Once you tested all of them and you know it is doable, make a prod cluster and migrate all closed indices . Then test your integrations and plan a rupture day. You can migrate services one by one to minimize data loss or make a planed downtime .
    You also need to read all the breaking changes inbetween your versions

    Login or Signup to reply.
  2. As what @TudorIftimie have said, it is indeed impossible for you to downgrade. Consider using the snapshot backup and restore. Here’s an example of what you might come up with,

    POST _snapshot/my_7_17_6_repo/mybackup-snapshot-miniforce-only/_restore?wait_for_completion=true&pretty=true
    

    and the output is:

    
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "snapshot_restore_exception",
            "reason" : "[my_7_17_6_repo:mybackup-snapshot-miniforce-only/B46Pe8_RRy6MjAi75pl-iQ] the snapshot was created with Elasticsearch version [8.1.3] which is higher than the version of this node [7.17.3]"
          }
        ],
        "type" : "snapshot_restore_exception",
        "reason" : "[my_7_17_6_repo:mybackup-snapshot-miniforce-only/B46Pe8_RRy6MjAi75pl-iQ] the snapshot was created with Elasticsearch version [8.1.3] which is higher than the version of this node [7.17.3]"
      },
      "status" : 500
    }
     
    

    Due to that constraint, I suggest you use the Elasticdump. This provides you convenience to migrate or dump your indices from a higher version to a lower version. To do that, just use the following approach:

    Specific only to Ubuntu which I tested this

    apt install nodejs
    apt install npm
    npm install elasticdump
    
    

    In my cluster which has 8.1.3, I have the following indices called the_mini_force. Now, I wanted to dump this to 7.17.6 version, I imply run:

    Migrate the data mapping

    NODE_TLS_REJECT_UNAUTHORIZED=0  ./elasticdump --input-cert /etc/elasticsearch-ca-8.1.3.pem --input=https://elastic:[email protected]:9200/the_mini_force --output-cert /etc/elasticsearch-ca-7.17.pem --output=https://elastic:[email protected]:9200/the_mini_force --type=mapping
    

    Migrate the actual data

    NODE_TLS_REJECT_UNAUTHORIZED=0  ./elasticdump --input-cert /etc/elasticsearch-ca-8.1.3.pem --input=https://elastic:[email protected]:9200/the_mini_force --output-cert /etc/elasticsearch-ca-7.17.pem --output=https://elastic:[email protected]:9200/the_mini_force --type=data
    

    To explain further, my test shows you a cluster with a SSL certificate. Since I have just only a self-signed cert, you need to add NODE_TLS_REJECT_UNAUTHORIZED=0 if that is your case. Otherwise, you can just ignore that. Also you can see I supplied the cert location for both different version clusters. Which basically 192.168.40.141:9200 run on 8.1.3, and 192.168.40.146:9200 runs on 7.17.6.

    This allows me to migrate data efficiently from higher version going to lower version. In fact, you can also do this vice-versa if you want to migrate from lower version to higher version as well and it works.

    I suggest you try and test this. On my end, I use ClusterControl to allow me to test efficiently on Elasticsearch 8.1.3 version and Elasticsearch 7.17.6 version if that helps you test with speed. Good luck!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search