{"id":331214,"date":"2022-03-29T15:00:35","date_gmt":"2022-03-29T15:00:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331214"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331214","title":{"rendered":"<span>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 MapReduce \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0411\u0414<\/span>"},"content":{"rendered":"<div><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/top-fwz1.mail.ru\/counter?id=3200881;js=na\" width=\"1\" style=\"display: none;\"><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/vk.com\/rtrg?p=VK-RTRG-1288550-e6f1C\" width=\"1\" style=\"display: none;\"><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/www.facebook.com\/tr?id=1220899431627792&amp;ev=PageView&amp;noscript=1\" width=\"1\" style=\"display: none;\"><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0430\u0442\u0431\u0435\u043a, \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 Tarantool. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043f\u043e\u0438\u0441\u043a, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0438 \u043e\u0431\u044a\u0451\u043c\u0430 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0423\u0441\u043b\u043e\u0432\u043d\u043e \u043d\u0430\u0437\u043e\u0432\u0443 \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 <strong>\u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041e\u043f\u0438\u0448\u0443\u00a0\u043e\u0431\u0449\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439\u00a0CRUD-\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0438 \u043a\u0430\u043a \u0438\u0445 \u0440\u0435\u0448\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0411\u0414 Tarantool (\u0432\u0435\u0440\u0441\u0438\u044f \u2265 1.10), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 Tarantool-Cartridge (\u0432\u0435\u0440\u0441\u0438\u044f 2.7.0).<\/p>\n<p>\u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/465503\/\">Tarantool-Cartidge<\/a>, \u043c\u043e\u0434\u0443\u043b\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/436916\/\">vshard<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u044f\u0437\u044b\u043a\u043e\u043c Lua, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043d\u0451\u043c.<\/p>\n<h3>\u041e\u0431\u0449\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 CRUD-\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 <code>user<\/code>, \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e <code>id<\/code>. \u0412 Tarantool \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0440\u043c\u0438\u043d space, \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 &#171;\u0441\u043f\u0435\u0439\u0441&#187;. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/Satbek\/search-index\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0418\u0441\u043a\u043e\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043f\u0435\u0439\u0441\u0435 <code>user<\/code> \u0432 \u0442\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<pre><code class=\"lua\">|id(uuid)|bucket_id(number)|name(string)|birthdate(number)|phone_number(string)|<\/code><\/pre>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0448\u0430\u0440\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e <code>id<\/code>. \u0415\u0441\u0442\u044c <code>primary index<\/code> \u043f\u043e <code>id<\/code> \u0438 <code>secondary index<\/code> \u043f\u043e <code>name<\/code>.<\/p>\n<p>\u041a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435?<\/p>\n<h4>\u041f\u043e\u0438\u0441\u043a \u043f\u043e id<\/h4>\n<pre><code class=\"lua\">-- router side local bucket_id = vshard.router.bucket_id(user_id) user = vshard.router.callrw(bucket_id, 'get_user_by_id', {user_id}, {timeout = 1}) -- storage side local M = {} function M.get_user_by_id(id)     local user_t = get_user_tuple_by_id(id)     if user_t == nil then         return nil, M.user_not_exists_err:new('id=%s', id)     end     return user_tuple_to_output(user_t) end<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e <code>id<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0434\u043b\u044f Tarantool \u043f\u043e\u0434\u0445\u043e\u0434. \u041c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c <code>bucket_id<\/code> \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c storage-\u0443\u0437\u043b\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0448\u043b\u0451\u043c \u0442\u0443\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0437\u0430 \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0441\u043a\u043e\u043c\u043e\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f72\/86a\/599\/f7286a599e9db514649a3275b5b6c852.png\" width=\"1156\" height=\"914\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f72\/86a\/599\/f7286a599e9db514649a3275b5b6c852.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u041f\u043e\u0438\u0441\u043a \u043f\u043e name<\/h4>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u00a0\u043f\u043e\u0438\u0441\u043a \u043f\u043e <code>name<\/code>. \u0417\u0434\u0435\u0441\u044c \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043e\u0434\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 master-storage \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443\u00a0\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bb1\/200\/a12\/bb1200a129865cec0a46e8e76affa4cd.png\" width=\"1156\" height=\"914\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bb1\/200\/a12\/bb1200a129865cec0a46e8e76affa4cd.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"lua\">-- router side local M = {} function M.find_users_by_name(name)     local storage_uris = cartridge_rpc.get_candidates('app.roles.storage', {leader_only = true})     local res_by_uri, err = cartridge_pool.map_call('storage_api.get_users_by_name', {name}, {uri_list = storage_uris, timeout = M.vshard_timeout})      if err ~= nil then         return nil, err     end      local result = {}     for _, res in pairs(res_by_uri) do         for _, user in pairs(res) do             table.insert(result, user)         end     end     return result end  -- storage side local M = {} function M.get_users_by_name(user_name)     local yield_every = 100     local count = 1      local result = {}     for _, t in box.space.user.index.name:pairs({user_name}, 'EQ') do         if count % yield_every == 0 then             fiber.yield()         end          count = count + 1         table.insert(result, user_tuple_to_output(t))     end      return result end<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u0438\u0441\u043a\u043e\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0430\u0441\u0442\u0435\u0440\u0430\u0445 \u0438 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0445 \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e.\u00a0\u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u043f\u043e\u043b\u044e <code>name<\/code>. \u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u00ab\u0438\u043c\u0435\u043d\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430\u00bb \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043e\u0431\u044a\u0451\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c \u043f\u043e\u0438\u0441\u043a<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0438\u043c\u0435\u043d\u0438: \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430 storage \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c MapReduce \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430. \u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0438 \u0435\u0451 \u0434\u0430\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f Tarantool\/crud. \u041d\u043e \u0432\u0441\u0451 \u0436\u0435 \u0443 \u043d\u0435\u0451 \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a: \u043f\u043e\u043b\u0435 \u00ab\u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\u00bb, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 <code>user<\/code>. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0438\u0441\u043a\u043e\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u043d\u0430<\/strong> <strong>\u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0442\u0435\u0440\u0435<\/strong>. \u041d\u043e \u0432 \u0441\u0445\u0435\u043c\u0435 \u0441 MapReduce \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u043e\u0431\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u043c\u0430\u0441\u0442\u0435\u0440\u044b, \u0438 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0438\u0445 \u0434\u0432\u0435 \u0448\u0442\u0443\u043a\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 10  \u2014 \u0442\u043e 10 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438 \u0442.\u0434. \u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0434\u0430 \u0435\u0449\u0451 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0430\u0441\u0442\u044c. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 <strong>\u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c<\/strong>.<\/p>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f<\/h3>\n<p>\u0422\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u043e\u043d\u0438 \u043b\u0435\u0436\u0430\u0442. \u0417\u043d\u0430\u0447\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041f\u043e\u0436\u0435\u0440\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.\u00a0<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0435\u0439\u0441 <code>user_search_index<\/code>: <\/p>\n<pre><code class=\"lua\">|user_id(string-uuid)|bucket_id(unsigned)|data_hash(string)|data(any)|<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u0435\u0439\u0441 \u0438 \u0431\u0443\u0434\u0435\u0442 <strong>\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u043c \u0441\u043b\u043e\u0435\u043c<\/strong>. \u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c <code>data_hash<\/code> \u043e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<pre><code class=\"lua\">--\u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c local msgpack = require('msgpack') local digest = require('digest')  local data = {'phone-number', '202-555-0165'} local data_hash = digest.md5_hex(msgpack.encode(data))<\/code><\/pre>\n<p>\u0421\u043f\u0435\u0439\u0441 <code>user_search_index<\/code> \u0448\u0430\u0440\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f  \u043f\u043e <code>data_hash<\/code>. \u0418 \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438, \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c <code>data<\/code>. <a href=\"https:\/\/github.com\/Satbek\/search-index\/blob\/master\/app\/identifier.lua\">\u0417\u0434\u0435\u0441\u044c<\/a> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0445\u044d\u0448\u0435\u0439:<\/p>\n<pre><code class=\"lua\">local M = {}  local digest = require('digest') local msgpack = require('msgpack') M.cmp_data = {}  local Identifier = {}  function Identifier:new(data)     local obj = {}     obj.hash = digest.md5_hex(msgpack.encode(data))     obj.data = data     return obj end  function M.phone_number(phone_number)     local data = {'phone_number', phone_number}     return Identifier:new(data) end  function M.cmp_data.phone_number(data_one, data_two)     return #data_one == 2 and #data_two == 2 and (data_one[1] == data_two[1]) and (data_one[2] == data_two[2] ~= nil) end  return M<\/code><\/pre>\n<h4>Read<\/h4>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435:<\/p>\n<ul>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0445\u044d\u0448 \u043e\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u043d\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 <code>user_search_index<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0448\u043b\u0451\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 storage \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e <code>primary-key<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430:<\/p>\n<pre><code class=\"lua\">-- api.lua local M = {} function M.find_users_by_phone_number(phone_number)     local user_ids, err = M.search_index.user_id.get_by_phone_number(phone_number)     if err ~= nil then         err = errors.wrap(err)         return nil, err     end      return get_users_by_ids(user_ids) end  -- search_api.lua local M = {} function M.user_id.get_by_phone_number(phone_number)     local identifier = M.identifier.phone_number(phone_number)      local bucket_id = M.vshard_router.bucket_id_mpcrc32(identifier.hash)      local ids, err = M.vshard_router.callrw(bucket_id, 'search_storage_api.user_id.get_by_phone_number',         {identifier.hash, identifier.data}, {timeout = M.vshard_timeout}     )     if err ~= nil then         err = errors.wrap(err)         return nil, err     end     return ids end  -- search_storage_api.lua local M = {} local function get_users_by_hash(hash, data, cmp_func)     local result = {}     for _, t in box.space.user_search_index.index.hash:pairs({hash}, 'EQ') do         if t.data_hash ~= hash then             break         end         if cmp_func(t.data, data) then             result[#result + 1] = t.user_id         end     end     if #result == 0 then         return nil, not_found_err:new()     end     return result end  function M.user_id.get_by_phone_number(hash, data)     return get_users_by_hash(hash, data, M.cmp_data.phone_number) end<\/code><\/pre>\n<p>\u041e\u0431\u043e\u0448\u043b\u0438\u0441\u044c \u0431\u0435\u0437 MapReduce. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <code>primary_key<\/code>, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043e\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u0418\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0441 \u0443\u0440\u043e\u0432\u043d\u044f \u0411\u0414 \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0438 \u0434\u0430\u0442\u044b \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"lua\">-- identifier.lua  local M = {}  local digest = require('digest') local msgpack = require('msgpack') M.cmp_data = {}  local Identifier = {}  function Identifier:new(data)     local obj = {}     obj.hash = digest.md5_hex(msgpack.encode(data))     obj.data = data     return obj end  ...  function M.name_birthdate(name, birthdate)     local data = {'name', name, 'birthdate', birthdate}     return Identifier:new(data) end  function M.cmp_data.name_birthdate(data_one, data_two)     return #data_one == 4 and #data_two == 4 and             (data_one[1] == data_two[1]) and             (data_one[2] == data_two[2] ~= nil) and             (data_one[3] == data_two[3] ~= nil) and             (data_one[4] == data_two[4] ~= nil) end  return M<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0443 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<h4>Write<\/h4>\n<p>\u0412\u044b\u0448\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b, \u043a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0432 \u0444\u043e\u043d\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 Tarantool\/queue \u0438 Tarantool\/sharded-queue. \u0412 <a href=\"https:\/\/github.com\/Satbek\/search-index\/blob\/master\/app\/roles\/search-worker.lua\">\u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a> \u0435\u0441\u0442\u044c \u043d\u0430\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Tarantool\/queue.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <strong>\u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f<\/strong> \u043c\u044b \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u043c\u00a0\u0447\u0442\u0435\u043d\u0438\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7dc\/1f0\/ddb\/7dc1f0ddb2391ddba4715526cee875c1.png\" width=\"1774\" height=\"914\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7dc\/1f0\/ddb\/7dc1f0ddb2391ddba4715526cee875c1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u043d\u0435 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c. \u0422\u043e \u0435\u0441\u0442\u044c\u00a0 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0438\u0441\u043a \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0435\u0440\u043d\u0451\u0442, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0411\u0414 \u0443\u0436\u0435 \u0431\u0443\u0434\u0443\u0442. \u0418\u043b\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u043e\u0432\u044b\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c, \u0430 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439 \u0435\u0449\u0451 \u043d\u0435\u0442. \u041d\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u044b. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439, \u0430 \u0437\u0430\u0442\u0435\u043c \u2014 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h4>\u0418\u0442\u043e\u0433\u0438<\/h4>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439:\u00a0<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043d\u0438\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043b\u044e\u0431\u044b\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u043c\u0441\u044f \u0443 \u0432\u0430\u0441.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043a\u0430\u0447\u0430\u0442\u044c Tarantool \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/www.tarantool.io\/ru\/download?utm_source=habr&amp;utm_medium=articles&amp;utm_campaign=2021\">\u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>, \u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043c\u043e\u0449\u044c \u2014 <a href=\"https:\/\/t.me\/tarantoolru?utm_source=habr&amp;utm_medium=articles&amp;utm_campaign=2021\">\u0432 Telegram-\u0447\u0430\u0442\u0435<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/vk\/blog\/657789\/\"> https:\/\/habr.com\/ru\/company\/vk\/blog\/657789\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0430\u0442\u0431\u0435\u043a, \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 Tarantool. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043f\u043e\u0438\u0441\u043a, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0438 \u043e\u0431\u044a\u0451\u043c\u0430 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0423\u0441\u043b\u043e\u0432\u043d\u043e \u043d\u0430\u0437\u043e\u0432\u0443 \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 <strong>\u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041e\u043f\u0438\u0448\u0443\u00a0\u043e\u0431\u0449\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439\u00a0CRUD-\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0438 \u043a\u0430\u043a \u0438\u0445 \u0440\u0435\u0448\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0411\u0414 Tarantool (\u0432\u0435\u0440\u0441\u0438\u044f \u2265 1.10), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 Tarantool-Cartridge (\u0432\u0435\u0440\u0441\u0438\u044f 2.7.0).<\/p>\n<p>\u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/465503\/\">Tarantool-Cartidge<\/a>, \u043c\u043e\u0434\u0443\u043b\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/436916\/\">vshard<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u044f\u0437\u044b\u043a\u043e\u043c Lua, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043d\u0451\u043c.<\/p>\n<h3>\u041e\u0431\u0449\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 CRUD-\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 <code>user<\/code>, \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e <code>id<\/code>. \u0412 Tarantool \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0440\u043c\u0438\u043d space, \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 &#171;\u0441\u043f\u0435\u0439\u0441&#187;. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/Satbek\/search-index\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0418\u0441\u043a\u043e\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043f\u0435\u0439\u0441\u0435 <code>user<\/code> \u0432 \u0442\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<pre><code class=\"lua\">|id(uuid)|bucket_id(number)|name(string)|birthdate(number)|phone_number(string)|<\/code><\/pre>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0448\u0430\u0440\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e <code>id<\/code>. \u0415\u0441\u0442\u044c <code>primary index<\/code> \u043f\u043e <code>id<\/code> \u0438 <code>secondary index<\/code> \u043f\u043e <code>name<\/code>.<\/p>\n<p>\u041a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435?<\/p>\n<h4>\u041f\u043e\u0438\u0441\u043a \u043f\u043e id<\/h4>\n<pre><code class=\"lua\">-- router side local bucket_id = vshard.router.bucket_id(user_id) user = vshard.router.callrw(bucket_id, 'get_user_by_id', {user_id}, {timeout = 1}) -- storage side local M = {} function M.get_user_by_id(id)     local user_t = get_user_tuple_by_id(id)     if user_t == nil then         return nil, M.user_not_exists_err:new('id=%s', id)     end     return user_tuple_to_output(user_t) end<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e <code>id<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0434\u043b\u044f Tarantool \u043f\u043e\u0434\u0445\u043e\u0434. \u041c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c <code>bucket_id<\/code> \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c storage-\u0443\u0437\u043b\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0448\u043b\u0451\u043c \u0442\u0443\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0437\u0430 \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0441\u043a\u043e\u043c\u043e\u0435.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u041f\u043e\u0438\u0441\u043a \u043f\u043e name<\/h4>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u00a0\u043f\u043e\u0438\u0441\u043a \u043f\u043e <code>name<\/code>. \u0417\u0434\u0435\u0441\u044c \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043e\u0434\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 master-storage \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443\u00a0\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<pre><code class=\"lua\">-- router side local M = {} function M.find_users_by_name(name)     local storage_uris = cartridge_rpc.get_candidates('app.roles.storage', {leader_only = true})     local res_by_uri, err = cartridge_pool.map_call('storage_api.get_users_by_name', {name}, {uri_list = storage_uris, timeout = M.vshard_timeout})      if err ~= nil then         return nil, err     end      local result = {}     for _, res in pairs(res_by_uri) do         for _, user in pairs(res) do             table.insert(result, user)         end     end     return result end  -- storage side local M = {} function M.get_users_by_name(user_name)     local yield_every = 100     local count = 1      local result = {}     for _, t in box.space.user.index.name:pairs({user_name}, 'EQ') do         if count % yield_every == 0 then             fiber.yield()         end          count = count + 1         table.insert(result, user_tuple_to_output(t))     end      return result end<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u0438\u0441\u043a\u043e\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0430\u0441\u0442\u0435\u0440\u0430\u0445 \u0438 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0445 \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e.\u00a0\u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u043f\u043e\u043b\u044e <code>name<\/code>. \u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u00ab\u0438\u043c\u0435\u043d\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430\u00bb \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043e\u0431\u044a\u0451\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c \u043f\u043e\u0438\u0441\u043a<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0438\u043c\u0435\u043d\u0438: \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430 storage \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c MapReduce \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430. \u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0438 \u0435\u0451 \u0434\u0430\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f Tarantool\/crud. \u041d\u043e \u0432\u0441\u0451 \u0436\u0435 \u0443 \u043d\u0435\u0451 \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a: \u043f\u043e\u043b\u0435 \u00ab\u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\u00bb, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 <code>user<\/code>. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0438\u0441\u043a\u043e\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u043d\u0430<\/strong> <strong>\u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0442\u0435\u0440\u0435<\/strong>. \u041d\u043e \u0432 \u0441\u0445\u0435\u043c\u0435 \u0441 MapReduce \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u043e\u0431\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u043c\u0430\u0441\u0442\u0435\u0440\u044b, \u0438 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0438\u0445 \u0434\u0432\u0435 \u0448\u0442\u0443\u043a\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 10  \u2014 \u0442\u043e 10 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438 \u0442.\u0434. \u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0434\u0430 \u0435\u0449\u0451 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0430\u0441\u0442\u044c. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 <strong>\u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c<\/strong>.<\/p>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f<\/h3>\n<p>\u0422\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u043e\u043d\u0438 \u043b\u0435\u0436\u0430\u0442. \u0417\u043d\u0430\u0447\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041f\u043e\u0436\u0435\u0440\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.\u00a0<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0435\u0439\u0441 <code>user_search_index<\/code>: <\/p>\n<pre><code class=\"lua\">|user_id(string-uuid)|bucket_id(unsigned)|data_hash(string)|data(any)|<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u0435\u0439\u0441 \u0438 \u0431\u0443\u0434\u0435\u0442 <strong>\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u043c \u0441\u043b\u043e\u0435\u043c<\/strong>. \u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c <code>data_hash<\/code> \u043e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<pre><code class=\"lua\">--\u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c local msgpack = require('msgpack') local digest = require('digest')  local data = {'phone-number', '202-555-0165'} local data_hash = digest.md5_hex(msgpack.encode(data))<\/code><\/pre>\n<p>\u0421\u043f\u0435\u0439\u0441 <code>user_search_index<\/code> \u0448\u0430\u0440\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f  \u043f\u043e <code>data_hash<\/code>. \u0418 \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438, \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c <code>data<\/code>. <a href=\"https:\/\/github.com\/Satbek\/search-index\/blob\/master\/app\/identifier.lua\">\u0417\u0434\u0435\u0441\u044c<\/a> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0445\u044d\u0448\u0435\u0439:<\/p>\n<pre><code class=\"lua\">local M = {}  local digest = require('digest') local msgpack = require('msgpack') M.cmp_data = {}  local Identifier = {}  function Identifier:new(data)     local obj = {}     obj.hash = digest.md5_hex(msgpack.encode(data))     obj.data = data     return obj end  function M.phone_number(phone_number)     local data = {'phone_number', phone_number}     return Identifier:new(data) end  function M.cmp_data.phone_number(data_one, data_two)     return #data_one == 2 and #data_two == 2 and (data_one[1] == data_two[1]) and (data_one[2] == data_two[2] ~= nil) end  return M<\/code><\/pre>\n<h4>Read<\/h4>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435:<\/p>\n<ul>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0445\u044d\u0448 \u043e\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u043d\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 <code>user_search_index<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0448\u043b\u0451\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 storage \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e <code>primary-key<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430:<\/p>\n<pre><code class=\"lua\">-- api.lua local M = {} function M.find_users_by_phone_number(phone_number)     local user_ids, err = M.search_index.user_id.get_by_phone_number(phone_number)     if err ~= nil then         err = errors.wrap(err)         return nil, err     end      return get_users_by_ids(user_ids) end  -- search_api.lua local M = {} function M.user_id.get_by_phone_number(phone_number)     local identifier = M.identifier.phone_number(phone_number)      local bucket_id = M.vshard_router.bucket_id_mpcrc32(identifier.hash)      local ids, err = M.vshard_router.callrw(bucket_id, 'search_storage_api.user_id.get_by_phone_number',         {identifier.hash, identifier.data}, {timeout = M.vshard_timeout}     )     if err ~= nil then         err = errors.wrap(err)         return nil, err     end     return ids end  -- search_storage_api.lua local M = {} local function get_users_by_hash(hash, data, cmp_func)     local result = {}     for _, t in box.space.user_search_index.index.hash:pairs({hash}, 'EQ') do         if t.data_hash ~= hash then             break         end         if cmp_func(t.data, data) then             result[#result + 1] = t.user_id         end     end     if #result == 0 then         return nil, not_found_err:new()     end     return result end  function M.user_id.get_by_phone_number(hash, data)     return get_users_by_hash(hash, data, M.cmp_data.phone_number) end<\/code><\/pre>\n<p>\u041e\u0431\u043e\u0448\u043b\u0438\u0441\u044c \u0431\u0435\u0437 MapReduce. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <code>primary_key<\/code>, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043e\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u0418\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0441 \u0443\u0440\u043e\u0432\u043d\u044f \u0411\u0414 \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0438 \u0434\u0430\u0442\u044b \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"lua\">-- identifier.lua  local M = {}  local digest = require('digest') local msgpack = require('msgpack') M.cmp_data = {}  local Identifier = {}  function Identifier:new(data)     local obj = {}     obj.hash = digest.md5_hex(msgpack.encode(data))     obj.data = data     return obj end  ...  function M.name_birthdate(name, birthdate)     local data = {'name', name, 'birthdate', birthdate}     return Identifier:new(data) end  function M.cmp_data.name_birthdate(data_one, data_two)     return #data_one == 4 and #data_two == 4 and             (data_one[1] == data_two[1]) and             (data_one[2] == data_two[2] ~= nil) and             (data_one[3] == data_two[3] ~= nil) and             (data_one[4] == data_two[4] ~= nil) end  return M<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0443 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<h4>Write<\/h4>\n<p>\u0412\u044b\u0448\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b, \u043a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0432 \u0444\u043e\u043d\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 Tarantool\/queue \u0438 Tarantool\/sharded-queue. \u0412 <a href=\"https:\/\/github.com\/Satbek\/search-index\/blob\/master\/app\/roles\/search-worker.lua\">\u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a> \u0435\u0441\u0442\u044c \u043d\u0430\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Tarantool\/queue.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <strong>\u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f<\/strong> \u043c\u044b \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u043c\u00a0\u0447\u0442\u0435\u043d\u0438\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u043d\u0435 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c. \u0422\u043e \u0435\u0441\u0442\u044c\u00a0 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0438\u0441\u043a \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0435\u0440\u043d\u0451\u0442, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0411\u0414 \u0443\u0436\u0435 \u0431\u0443\u0434\u0443\u0442. \u0418\u043b\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u043e\u0432\u044b\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c, \u0430 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439 \u0435\u0449\u0451 \u043d\u0435\u0442. \u041d\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u044b. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439, \u0430 \u0437\u0430\u0442\u0435\u043c \u2014 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h4>\u0418\u0442\u043e\u0433\u0438<\/h4>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043b\u043e\u0439:\u00a0<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043d\u0438\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043b\u044e\u0431\u044b\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u043c\u0441\u044f \u0443 \u0432\u0430\u0441.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043a\u0430\u0447\u0430\u0442\u044c Tarantool \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/www.tarantool.io\/ru\/download?utm_source=habr&amp;utm_medium=articles&amp;utm_campaign=2021\">\u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>, \u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043c\u043e\u0449\u044c \u2014 <a href=\"https:\/\/t.me\/tarantoolru?utm_source=habr&amp;utm_medium=articles&amp;utm_campaign=2021\">\u0432 Telegram-\u0447\u0430\u0442\u0435<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-331214","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=331214"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331214\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}