Category Archives: sadmin

sadmin

Magento tips ( maintenance )

Продължавам да се занимавам с едно ултра "добро" Магенто, че ми се наложи това за да го дебъгна т.е. да го спра за секунда и да го пусна отново :)

Сtatus на магентото
php bin/magento maintenance:status

Добавяне на IP което може да отваря магенто по време на поддръжка
php bin/magento maintenance:allow-ips 8.8.8.8

Списък на ip-тата които могат да отварят магенто по време на поддръжка
php bin/magento maintenance:allow-ips

Спиране на магенто за поддръжка
php bin/magento maintenance:enable

Стартиране на магенто след поддръжката
php bin/magento maintenance:disable

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

Elasticsearch Index Status е ‘червен’, а трябва да е 'зелен' Fix- (Magento Sux)

Идеята е да се поправи magento със status "red" :(

За целта изпълнявам грубо казано това:

0. Превключваме временно към mysql search engine

1. За да проверим статуса на индекса:
curl -m1 localhost:9200/_cluster/health?pretty

2. Преглеждаме индексите:
curl --silent -X GET localhost:9200/_cat/indices?v

3. Изтриваме индексите:
curl -XDELETE localhost:9200/*

4. php magento indexer:reindex

5. php magento indexer:status

/var/www/magento-live/bin # curl --silent -X GET localhost:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open magento2_en_catalog_product_20201015_163059 jUDhUAAmRAKy4YVR9R9_BQ 1 0 49986 0 36.3mb 36.3mb
green open magento2_bg_catalog_category_20201015_163116 f8MeZFvKRp6hyiy3FPp6CA 1 0 116 0 341.5kb 341.5kb
green open magento2_bg_tracking_log_event_20201015 ptX7KBhmTYeC83CBzb4VPA 1 0 9 0 39.1kb 39.1kb
green open magento2_bg_thesaurus_20201015_163119 Vv3pUf7VReq3pdCMBf2gKg 1 0 0 0 230b 230b
green open magento2_bg_tracking_log_session_20201015 kYrAfzUxRtSMUoaYsr2Rmg 1 0 1 0 4.9kb 4.9kb
green open magento2_en_catalog_category_20201015_163117 aeiRjcIvTpytVF1d0VtxVA 1 0 116 0 348.3kb 348.3kb
green open magento2_bg_catalog_product_20201015_163048 o787i88OTTmBiiYKW6zZ0Q 1 0 50294 0 36.1mb 36.1mb
green open magento2_en_thesaurus_20201015_163119 NSOrCmgLQoyIbObCSWQPbw 1 0 0 0 230b 230b

Тук са няколко хиледи индекси

След като изтрием виждаме, че статус е вече, green

/var/www/magento-live/bin # curl -m1 localhost:9200/_cluster/health?pretty
{
"cluster_name" : "elasticsearch",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 8,
"active_shards" : 8,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}

elasticsearch_magento_fix_status

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

Намиране на празните файлове под GNU/Linux

Идеята е да намерим празните файлове(рекурсивно) и респективно ако решим да ги правим нещо, в случая да ги изтрием.

Листваме всички празни файлове /рекурсивно
find $PWD -type f -empty

Изтрива всички празни файлове /рекурсивно
find $PWD -type f -empty -exec rm -fr {} \;

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

Инсталиране на Eclipse под GNU/Linux ( Hello Java World )

apt-get update && apt-get install -y openjdk-11-jdk;
wget http://mirror.umd.edu/eclipse/technology/epp/downloads/release/2020-06/R/eclipse-java-2020-06-R-linux-gtk-x86_64.tar.gz
tar -zxvf eclipse-java-2020-06-R-linux-gtk-x86_64.tar.gz -C /usr/
ln -s /usr/eclipse/eclipse /usr/bin/eclipse

Това е :)
Hello World :) :) :)

instalirane_na_eclipse_linux

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

Spotify на Linux

1. Регистрация в spotify.com

2. Инсталиране на клиента spotify-client

curl -sS https://download.spotify.com/debian/pubkey.gpg | sudo apt-key add --
curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add --
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list

sudo apt-get update && sudo apt-get install spotify-client

3. Музичка :)

spotify-linux

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

Как да си изключим монитора под GNU/Linux

Един стар съученик ме пита как да си изключи монитора след 8 часа. С "коя команда става". Ето и как става:

xset dpms force off

Ако трябва да има изчакване 8 часа то се ползва:
1. Sleep секунди
sleep 28800;xset dpms force off
#На практика ще изчака 28800 секунди и ще изключи монитора

2. Може да се направи с cron

3. Има още 919191 начина

izkliuchvane_na_monitor_linux

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 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)