Category Archives: sadmin

sadmin

Magento indexer:reindex и indexer:status

Прехвърляме на един клиент магазина от нИвИрУятнотУ "Magento" на наша къстъм система и респективно все проблеми проблеми, че трябва да го съпортваме докато го прехвърлим. Явно това е от използваните също нИвИрУятни команди за него. Може да са полезни за някои Magento фен :P

За мен да ползваш готова система за сериозен сайт е като да ползваш от тия стандартните кухни за 150 лв.(не, че нещо, ама си е така). Качеството си има цена. Да по продуктивни са от към време за изработка И ТОЛКОЗ(за недостатъците няма да говоря, че много писане ще падне), разбира се точно както стандартните кухни. Слагаш една кухня за 5 минути и готово, ама какво е готово е друг въпрос :) Въпрос на гледна точка.

/etc/init.d/elasticsearch restart
Рестартира демона ElasticSearch

php magento indexer:status
Показва статуса на индексите

magento_indexer_status

php magento indexer:reindex
Реиндексира всички индекси

magento_indexer_reindex

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Как се сменя клавиатура на лаптоп

Преди време клавиатурата изпи една пълна чаша с кафе, но веднага извадих батерията, разглобих лаптопчето и със сешоара внимателно го изсуших и всичко беше точно с аромат на кафе :).

Да, ама онзи ден изпи ПЪЛНА чаша с бира , толкова пълна че като го вдигнах потече все едно от изворче. Респективно пак същата работа като с кафето, ама няколко бутона не искат да работят и реших да я сменя.
Клавиатурата взех от "Компютърни Технологии", гр. Добрич, а смяната е супер елементарна. Няма нужда от обяснение, а просто от 2-3 снимки. Дано поста Ви е бил полезен.

smqna-klaviatura-laptop_1

smqna-klaviatura-laptop_2

smqna-klaviatura-laptop_3

smqna-klaviatura-laptop_4

smqna-klaviatura-laptop_5

Резултата:

smqna-klaviatura-laptop_6

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Magento -- SUX

Това Magento просто не съм очаквал, че е толкова бъгаво НЕЩО:

tail -f log/exception.log

Проблем N1:

[2020-09-07 14:45:00] main.CRITICAL: No alive nodes found in your cluster {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\NoNodesAvailableException(code: 0): No alive nodes found in your cluster at /var/www/magento-live/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:53)"} []

Решение N1: /etc/init.d/elasticsearch restart

Проблем N2:

[2020-09-07 14:45:40] main.CRITICAL: catalog_product index does not exist yet. Make sure everything is reindexed. {"report_id":"f54001a12b0abb106e826862e505a03f8ea41f3591d4663631a4315af8285696","exception":"[object] (LogicException(code: 0): catalog_product index does not exist yet. Make sure everything is reindexed. at /var/www/magento-live/vendor/smile/elasticsuite/src/module-elasticsuite-core/Index/IndexOperation.php:117)"} []

Решение N2: php magento indexer:reindex или Reindex от админ панела

Проблем N3:
# php magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Category Products index has been rebuilt successfully in 00:00:01
Product Categories index has been rebuilt successfully in 00:00:00
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Product EAV index has been rebuilt successfully in 00:00:01
Stock index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:01
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Catalog Search indexer process unknown error:
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}
Google Product Removal Feed index has been rebuilt successfully in 00:00:00
Google Product Feed index has been rebuilt successfully in 00:00:00
ElasticSuite Category Indexing indexer process unknown error:
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}
ElasticSuite Thesaurus Indexing indexer process unknown error:
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}

Решение N3:
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

MySQL Експорт на продукти от Magento

Една проста заявка за експорт на всички продукти на Magento с всички необходими атрибути:
Име, цена, промо цена, промо цена от-до, бранд ид,бранд, цвят и т.н.

Целта, разбира се е да експортнем данните от Магент`У и да ги налеем в наш къстъм магазин!

SELECT e.entity_id AS 'id',

e.sku,

d1.value AS 'price',
d2.value AS 'weight',
d3.value AS 'special_price',

t1.value AS 'short_description',
t2.value AS 'description',

v1.value AS 'name',
v2.value AS 'image',
v3.value AS 'thumbnail',

v4.value AS 'meta_description',
v5.value AS 'meta_keyword',
v6.value AS 'meta_title',
v7.value AS 'pol',

mg.value AS 'media_gallery',

i1.value AS 'color',
i2.value AS 'manufacturer',
i3.value AS 'status',

dt1.value AS 'special_from_date',
dt2.value AS 'special_to_date',

cids.category_ids AS 'category_ids',
cids.category_names AS 'category_names',

(SELECT v.value as manufacturer_name FROM catalog_product_entity_int i LEFT JOIN eav_attribute_option o ON i.value = o.option_id LEFT JOIN eav_attribute_option_value v ON o.option_id = v.option_id AND v.store_id = 0 LEFT JOIN catalog_product_entity e ON i.entity_id = e.entity_id WHERE i.attribute_id = 83 and i.entity_id=id AND i.store_id = 0 ) as manufacturer_title,

(SELECT v.value as color_title FROM catalog_product_entity_int i LEFT JOIN eav_attribute_option o ON i.value = o.option_id LEFT JOIN eav_attribute_option_value v ON o.option_id = v.option_id AND v.store_id = 0 LEFT JOIN catalog_product_entity e ON i.entity_id = e.entity_id WHERE i.attribute_id = 93 and i.entity_id=id AND i.store_id = 0 ) as color_title,

(SELECT v.value as pol_title FROM catalog_product_entity_varchar i LEFT JOIN eav_attribute_option o ON i.value = o.option_id LEFT JOIN eav_attribute_option_value v ON o.option_id = v.option_id AND v.store_id = 0 LEFT JOIN catalog_product_entity e ON i.entity_id = e.entity_id WHERE i.attribute_id = 171 and i.entity_id=id AND i.store_id = 0 ) as pol_title

FROM catalog_product_entity e

LEFT JOIN catalog_product_entity_varchar v1 ON e.entity_id = v1.entity_id
AND v1.store_id = 0
AND v1.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'name'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_text t1 ON e.entity_id = t1.entity_id
AND t1.store_id = 0
AND t1.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'short_description'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))
LEFT JOIN catalog_product_entity_text t2 ON e.entity_id = t2.entity_id
AND t2.store_id = 0
AND t2.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'description'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))
LEFT JOIN catalog_product_entity_varchar v2 ON e.entity_id = v2.entity_id
AND v2.store_id = 0
AND v2.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'image'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))
LEFT JOIN catalog_product_entity_varchar v3 ON e.entity_id = v3.entity_id
AND v3.store_id = 0
AND v3.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'thumbnail'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))
LEFT JOIN catalog_product_entity_decimal d1 ON e.entity_id = d1.entity_id
AND d1.store_id = 0
AND d1.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'price'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_decimal d2 ON e.entity_id = d2.entity_id
AND d2.store_id = 0
AND d2.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'weight'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_int i1 ON e.entity_id = i1.entity_id
AND i1.store_id = 0
AND i1.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'color'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_int i2 ON e.entity_id = i2.entity_id
AND i2.store_id = 0
AND i2.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'manufacturer'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_int i3 ON e.entity_id = i3.entity_id
AND i3.store_id = 0
AND i3.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'status'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_varchar v4 ON e.entity_id = v4.entity_id
AND v4.store_id = 0
AND v4.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'meta_description'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_varchar v5 ON e.entity_id = v5.entity_id
AND v5.store_id = 0
AND v5.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'meta_keyword'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_varchar v6 ON e.entity_id = v6.entity_id
AND v6.store_id = 0
AND v6.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'meta_title'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_varchar v7 ON e.entity_id = v7.entity_id
AND v7.store_id = 0
AND v7.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'pol'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_decimal d3 ON e.entity_id = d3.entity_id
AND d3.store_id = 0
AND d3.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'special_price'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_datetime dt1 ON e.entity_id = dt1.entity_id
AND dt1.store_id = 0
AND dt1.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'special_from_date'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN catalog_product_entity_datetime dt2 ON e.entity_id = dt2.entity_id
AND dt2.store_id = 0
AND dt2.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'special_to_date'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))

LEFT JOIN

(SELECT m1.entity_id,
GROUP_CONCAT(m2.value) AS value
FROM catalog_product_entity_media_gallery_value_to_entity m1
INNER JOIN catalog_product_entity_media_gallery m2 ON m2.value_id = m1.value_id
AND m2.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'media_gallery'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_product'))
GROUP BY m1.entity_id) mg ON e.entity_id = mg.entity_id
LEFT JOIN

(SELECT product_id,
GROUP_CONCAT(c.category_id SEPARATOR ',') AS category_ids,
GROUP_CONCAT(cv.value SEPARATOR ',') AS category_names
FROM catalog_category_product c
INNER JOIN catalog_category_entity_varchar cv ON c.category_id = cv.entity_id
AND cv.store_id = 0
AND cv.attribute_id =
(SELECT attribute_id
FROM eav_attribute
WHERE attribute_code = 'name'
AND entity_type_id =
(SELECT entity_type_id
FROM eav_entity_type
WHERE entity_type_code = 'catalog_category'))
GROUP BY product_id) cids ON e.entity_id = cids.product_id limit 10 \G

Експорт на ПРодукти от Magento
Експорт на ПРодукти от Magento
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Mysql към mariaDB грешка

[Thu Aug 20 08:15:31.535040 2020] [:error] [pid 23449] [client 127.0.0.1:37030] PHP Warning: mysql_connect(): Server is running in --secure-auth mode, but 'XXXX'@'localhost' has a password in the old format; please change the password to the new format in XXX/system/database/mysql.php on line 6

SHOW GLOBAL VARIABLES LIKE '%auth%';

Временен фикс
SET GLOBAL secure_auth="OFF";

за постоянно:

/etc/my.cnf

[mysqld]
secure-auth=off

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Спиране на всички логове (access , error) на apache и nginx

find /etc/apache2/sites-enabled/* -exec sed -i 's/#*[Cc]ustom[Ll]og/#CustomLog/g' {} \;
find /etc/apache2/sites-enabled/* -exec sed -i 's/#*[Ee]rror[Ll]og/#ErrorLog/g' {} \;

find /etc/nginx/sites-enabled/* -exec sed -i 's/#*access_log/#access_log/g' {} \;
find /etc/nginx/sites-enabled/* -exec sed -i 's/#*error_log/#error_log/g' {} \;

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Debian Failed to fully start up daemon: Input/output error

dmesg грешка

[61408197.314934] systemd-logind[11073]: Failed to enable subscription: Launch helper exited with unknown return code 1
[61408197.317593] systemd-logind[11073]: Failed to fully start up daemon: Input/output error
[61408495.892682] systemd-logind[14386]: Failed to enable subscription: Launch helper exited with unknown return code 1
[61408495.895484] systemd-logind[14386]: Failed to fully start up daemon: Input/output error
[61408797.441160] systemd-logind[18168]: Failed to enable subscription: Launch helper exited with unknown return code 1
[61408797.444052] systemd-logind[18168]: Failed to fully start up daemon: Input/output error
[61408915.209397] systemd-logind[19324]: Failed to enable subscription: Launch helper exited with unknown return code 1
[61408915.212378] systemd-logind[19324]: Failed to fully start up daemon: Input/output error

Fix: apt-get install systemd-shim

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Грешка на Symfony3 The server returned a “500 Internal Server Error”

При човъркане на един Symfony3 проект излезе тая грешка, но ето го и супер сложния фикс :)

root:/var/www/public_html# php bin/console cache:clear --env=prod

// Clearing the cache for the prod environment with debug false

[OK] Cache for the "prod" environment (debug=false) was successfully cleared.

screenshot_2020-02-10-an-error-occurred-internal-server-error

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)