Magento 2 Indexing - magento

We have one Magento 2 project where we configured cron every min. Ideally the site has no change but still all cron jobs running too frequently.
Questions :
How Magento consider to re-run a index even there is no change.
Magento cron running synchronize or parallels way.
How to prevent run indexing if there is no change any lock or anything Magento manage ?

If your indexer is update by schedule.
then only changed data will be reindexed not all.

There is a schedule set for the crons. If you find that the frequency is too short, you can change the frequency of crons in a crontab.xml file.
You need to know the cron's name and its instance.

You can refer following link for configure cron time.
https://amasty.com/blog/configure-magento-cron-job/

Related

How do I run a partial reindex in Magento 1.13?

I would like to be able to set all indexes to "Update on schedule" and then have them all update automatically like Magento says they should in the background. The problem is, this doesn't happen. There is no cron job that automatically reindexes (See this related question).
So, if I have to create my own cron job, how do I do this exactly in an efficient way? I don't want to run "php shell/indexer.php reindexall". That does full rebuilds of index tables. Sure, I could do that nightly, but that means that no changes will be reflected on the frontend until the next day. That's not an acceptable solution. If I run full reindexes throughout the day, I end up with the same problem that I have right now - table locks and slowness due to reindexing while people are working in the admin.
Magento's new "partial reindexing" should fix this right?
This is my understanding of how it works:
I edit an entity that has a related index (e.g. A product).
A database trigger adds a record to related change log tables.
Some process later reads the change log tables and reindexes these specific entities
Concrete example
I update a value in "catalog_product_entity_varchar".
The database trigger "trg_catalog_product_entity_varchar_after_update" flags this product as changed by inserting a new version into "catalog_product_flat_cl" and "catalogsearch_fulltext_cl".
A partial reindex process reads these change log tables and reindexes only the products mention to "catalog_product_flat" and "catalogsearch_fulltext" respectively.
If this were the case, the reindexing process would be minimal and could be run often. Even every minute to where indexing becomes almost unnoticeable to admin users. (I say every minute, because Magento tells us this is possible)
In this release, however, the flat catalog is updated for you — either every minute, or according to your Magento cron job.
Where is this mystical partial reindex? How do I call it instead of reindexing everything?
Is there a reindexPartial()?
The enterprise_refresh_index cron job appears to run this. It runs every time the Magento cron runs. See Enterprise_Index_Model_Observer::refreshIndex().
This is not intended to run manually because of the need to establish a lock file. It is easiest just to run the cron.php file if you need a manual reindex.
I believe I just have a project specific issue with this not running.
The partial reindexing is executed through the cron job operator built into Magento. You do not need to run the actual indexer.php file. Instead, you must setup Magento's built in Cron scheduler based on the documentation.
Documentation: http://www.magentocommerce.com/wiki/groups/227/setting_up_magento_in_cron
You simply execute the cron.php file, which will in turn call the partial reindexing process.
php5-cli -f /home/USERNAME/public_html/cron.php
How it works:
A change to the an entity is made and is flagged to be reindex.
A cronjob executes the cron.php file
Magento checks to see which cron tasks it will run, and runs the partial reindexing process
The indexing process will see the changed entity and update the index tables with the new values.

Magento reindexing still on Running even after Apache restart

When I check the status of my reindexing, the Product Prices are stuck on Running even after Apache has been restarted.
Locks files have been deleted from /var/locks
Only using CLI
Going nuts.
thanks!
Magento stores the status of indexes in index_process table. So when a index process fails for example through a timeout or restarting of apache this flag isn't removed. When indexing succeeds this flag is reset or you can set working to pending. Do you have any exceptions in your Magento logs?
Backup and delete all files under MAGENTO_ROOT/var/locks/

Automatic script Codeigniter

How to make sure that every 24 hours run script automatically, which compares the current time with the time that is stored in the database, and if the current time is greater then I need to make changes to the database. I use Codeigniter.
CRON Jobs is the solution, but it is not script, it's server based application that runs every given time. You can setup it from hosting panel, but not all of the hosting providers support it :(

how to set cron job for reindex

How to setup cron job for clear cache and re-indexing in Magento. i don't know how to set the cron for re-index. but i saw some where every day cron runs defaultly in magento. still i am facing re indexing issues in my site. i need to clear cache also.On Magento website here
they said that logcleaning and reindexing is commented out in the code so in which file I can un-comment to setup cron job fo log cleaning and reindexing?
thanks,
murali.
To create the cron job, add the following to your cron file to reindex every day at 6am
0 6 * * * php -f /shell/indexer.php reindexall
Note: If you get an error telling you you’re out of memory similar to:
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 7680 bytes) in …/app/code/core/Mage/Index/Model/Indexer.php on line 163
Try commenting out php_value memory_limit and php_value max_execution_time in your .htaccess file.
I have tested my solution in my cPanel 11.52.2.4. So stay calm and do following:
Navigate to your magento2 admin area. And click over System > Index Management.
From the Actions drop down select Update by schedule and click on submit.
That is it from admin section. Now navigate to the cPanel area and do following-
Login to your cPanel
Under cPanel click on Cron Jobs under Advanced tab group
If you have already created a cron job, you can edit it, or create a new cron job.
Select the frequency to run the cron job, suppose Once per week (0 0 * * 0).
Write the command to re-index the data, as
php-cli /home/username/public_html/sub_folder_if_any/bin/magento indexer:reindex
Save it. As per your schedule frequency, the cron job will run.
If you want lesser frequency, but note that if you put less frequency it will consume the resource.
Note: Make sure you replace <username> with your cPanel user name and /<sub_folder_if_any> as per your magento2 installation directory. If you are not using any sub directory just ignore it
We've the same problem and fixed change Megabytes to Bytes.
instead of set memory_limit 1024M we changed to 1073741824.
Looks like an issue at server... We're hosted at Media Temple using Plesk Panel
Hope you sorted it out sooner.
Regards

magento - index management - Cannot initialize the indexer process

I've just moved my Magento site to a new server and I'm trying to re-index my store using the Index Management.
I check all the boxes and re-index and I get the following:
Cannot initialize the indexer process.
I've looked at resetting the file permissions using the Magento Cleanup tool. But nothing I've tried seems to work.
Has anyone ever come across this before and how did they get past this?
Many thanks
I don't have any idea why you can't do it from the Index Management, but as a temporary solution, I would advise to use indexer.php script from the cmd line:
php /var/www/magento/shell/indexer.php reindexall. You can also run it by the system cron periodically, it should do the trick for a while.
delete files from var/locks and change permission of folder to 755, it will work..if donot have any issue with Dataseb files

Resources