Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Nyob zoo tav su, Habr!

Hom phiaj

Kuv lub koom haum siv email server ntawm Kerio Connect platform; mail servers raug teeb tsa hauv ntau lub nroog los pab lawv cov neeg siv. Thaum xub thawj tsis muaj cov qauv kev faib tawm, txij li cov npe sib txawv ntawm qib peb, qhia txog lub nroog ntawm qhov chaw. Txhua yam ua haujlwm thiab txhua tus zoo siab. Ib hnub zoo, kev tswj hwm tau teeb tsa txoj haujlwm, ib daim ntawv qhia hnub ua haujlwm ntawm txhua qhov chaw!

prehistory

Thaum pib, lub tswv yim yog los tsa Kerio Distributed Mail Domain thiab nws yuav ua txhua yam nws tus kheej. Tsis tau sai dua hais tias ua tiav, ib qho kev faib sau tau tsim, tab sis qhov ntawd tsis yog li ntawd, tus neeg rau zaub mov tau npaj txhij los synchronize daim ntawv qhia hnub, folders, kev sib cuag - nruab nrab ntawm cov chaw nyob ntawm tib lub server, tab sis tsis yog txhua yam mus synchronize cov ntaub ntawv ntawm ob peb. servers.

Kuv, ntawm chav kawm, tsis cia siab tias yuav ntes tau thiab ntev ntev tsis tuaj yeem ntseeg tias kev ua haujlwm kuv xav tau ploj lawm. Tom qab ntawd kuv pom cov ntaub ntawv pov thawj ntawm qhov tseeb no. Kuv ntxhov siab heev thiab poob siab los ntawm qhov no.

Txoj hauj lwm smoothly tig mus rau hauv ib qho teeb meem.

Cov kev xaiv twg yog dab tsi?

  • Tsim ob tus neeg siv khoom ntawm cov servers sib txawv uas sib pauv cov ntaub ntawv tsim nyog nrog qee qhov software thib peb. Nws yog ib qho tsim nyog los nrhiav qhov software thib peb uas yuav siv qhov kev ua haujlwm no - Kuv tsis nyiam qhov rake, tab sis nws zoo li qhov no yog qhov kev daws teeb meem nkaus xwb.
  • Sau koj tus kheej tsab ntawv rau cov ntaub ntawv synchronization ntawm servers. Qhov tseeb yog tias Kerio khaws txhua yam khoom raws li cov ntaub ntawv sib cais, yog li nws yog qhov tsim nyog los tsim ib tsab ntawv rau kev ua haujlwm nrog cov ntaub ntawv, tab sis nyob rau hauv qhov pom ntawm cov peev txheej txaus, txoj haujlwm zoo li nyuaj me ntsis, tshwj xeeb tshaj yog vim nws tsim nyog ua ntau yam. kuaj xyuas qhov tseeb ntawm cov ntaub ntawv, yog tias ib tus neeg tsim cov haujlwm hauv tib lub sijhawm, thiab lwm yam, thiab lwm yam.

Saib ua ntej, kuv yuav hais tias txawm hais tias Kerio khaws ib qho khoom raws li cov ntaub ntawv sib cais, nws tsis yog ruam li nug seb cov ntaub ntawv kaw lus ua li cas txhua zaus koj nkag mus rau qhov khoom.

Tau siv sijhawm ntau los xav, kos ib pawg ntawm daim ntawv nrog cov phiaj xwm "kom txeeb tau yeeb ncuab thaj chaw," thaum 6 teev tsaus ntuj kuv tau txiav txim siab ob qho:

  • Thawj qhov kev txiav txim siab yog ua koj tus kheej thiab tsis nrhiav dab tsi los ntawm sab nraud.
  • Qhov thib ob daws yog mus pw.

Twb yog thaum sawv ntxov kuv sawv nrog ib qho kev xav thiab qhov tseeb, uas tau txo qis rau ob peb tsab ntawv - DFS

kev txiav txim siab

Txoj kev daws nws tus kheej zoo li no

  • nqa tag nrho cov servers uas yuav koom nrog synchronization rau OS Windows. (Ib feem ntawm nws yog nyob rau Linux. Kev xa cov ntaub ntawv xa mus rau lwm OS yog xav tau)
  • Txiav txim siab tus qauv ntawm cov npe uas yuav koom nrog hauv synchronization - lawv yuav tsum zoo ib yam.
  • Txhais tag nrho cov mail servers hauv ib lub npe nrog ib qho chaw DFS.
  • Tsim cov saum toj no-hais faib Kerio sau, txij li hauv kuv rooj plaub cov ntaub ntawv synchronization yuav tsum tau, tsis yog ntawm cov servers nkaus xwb tab sis kuj nyob nruab nrab ntawm cov thawj; qhov thib ob tuaj yeem tswj hwm los ntawm Kerio server ntawm nws tus kheej. (tsis zoo li thawj tus)
  • Teem synchronized directory rau DFS chaw.
  • Tuaj nrog qee yam ntoo (tom qab tag nrho, koj tsis tuaj yeem nyob tsis muaj tus ntoo khaub lig)

Kev siv

Piv txwv ntawm ob mail servers (tej zaum ntau dua)

1. Kerio Distributed domain

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tus Xib Hwb tsis koom nrog synchronization, tab sis qhov no tsis yog qhov yuav tsum tau ua ua ntej.

Kuv yuav tsis piav qhia yuav ua li cas tsa Kerio faib npe, tsis muaj dab tsi nyuaj txog nws, koj tuaj yeem kawm cov nom ua manul

Thaum kawg, koj yuav tsum pom cov duab hauv qab no hauv kev tswj hwm console:

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tom ntej no kuv xav tau cov folders sib koom; ntawm Master server koj tuaj yeem qhia cov kev xaiv hauv qab no:

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tshwj xeeb rau txhua qhov chaw - tus neeg rau zaub mov yuav tsis synchronize pej xeem folders ntawm cov thawj

Feem ntau rau txhua qhov chaw - tag nrho cov servers yuav tso tseg cov ntaub ntawv pej xeem uas twb muaj lawm hauv txhua qhov sau npe thiab tsim cov ntawv tshiab tshiab rau txhua qhov chaw ntawm txhua tus neeg xa ntawv.

Ceev faj Txawm hais tias qhov kev xaiv no hloov txoj cai teeb tsa ntawm txhua lub servers, nws synchronizes nyias los ntawm txhua tus neeg rau zaub mov (uas yog, tsis muaj ib qho chaw sib txawv)

Tus thawj coj tseem yuav muaj peev xwm faib kev nkag mus ntawm cov neeg siv.
nyob rau hauv kuv rooj plaub, lawv yog tag nrho kuv thiab kuv xav tau tag nrho synchronization (nyob rau hauv koj rooj plaub, cov kev daws yuav txawv) ntawm txhua tus neeg rau zaub mov koj yuav tsum tau tsim ib tug zoo tib yam pawg ntawm cov thawj uas yuav tsum tau synchronized.

2. Kerio cov ntaub ntawv teev npe

Tam sim no koj yuav tsum tsim cov npe sib xws uas yuav tsum tau synchronized ntawm txhua tus servers. Folders, Calendar, Contacts.

Tswv yim - tsim cov npe hauv lus Askiv, yog tias koj tsim lawv hauv Latin, cov npe yuav muaj npe hauv qee qhov kev nkag tsis tau, qhov no yog qhov tsis yooj yim.

Tam sim no koj yuav tsum nrhiav txoj hauv kev ntawm lub mail folders ntawm txhua tus neeg rau zaub mov.

Feem ntau rau txhua qhov chaw ~DataMailmail#publicΠ‘ΠΈΠ½Ρ…Ρ€ΠΎΠ½ΠΈΠ·ΠΈΡ€ΡƒΠ΅ΠΌΡ‹ΠΉ ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³#msgs
Tshwj xeeb rau txhua qhov chaw ~DataMailmail**Domain**#publicΠ‘ΠΈΠ½Ρ…Ρ€ΠΎΠ½ΠΈΠ·ΠΈΡ€ΡƒΠ΅ΠΌΡ‹ΠΉ ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³#msgs

Thov nco ntsoov tias peb yuav tsis synchronize tag nrho cov npe, tab sis tsuas yog lub thawv nrog cov ntaub ntawv #msgs - cov khoom lawv tus kheej tau khaws cia ntawm no, tag nrho lwm cov ntaub ntawv yuav tsum tau cais rau txhua tus neeg rau zaub mov.

3. DFS

Kuv yuav tsis piav qhia meej yuav ua li cas teeb tsa DFS, muaj cov ntaub ntawv txaus ntawm qhov teeb meem no.

DFS yog lub luag haujlwm pabcuam hauv Windows Server uas muab lub peev xwm los ua ke sib koom cov folders nyob ntawm cov servers sib txawv
Txuas rau MS DFS cov ntaub ntawv

Ua ntej teeb tsa DFS, koj yuav tsum nres tag nrho cov xa ntawv xa ntawv uas yuav koom nrog cov ntaub ntawv synchronization.

Tom qab ua tiav cov teeb tsa, koj yuav tsum tau txais cov duab hauv qab no rau txhua qhov synchronized folders

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Lawm, peb tsis tas yuav luam tawm cov folders replicated.

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tom qab replication tshwm sim (thiab tsis muaj ib yam dab tsi tshwj xeeb rau replicate muaj - cov folders yog khoob), cov xa ntawv tuaj yeem pib.

Tom ntej no, koj tuaj yeem sau ib qho ntawm cov mail servers nrog cov ntaub ntawv thiab xyuas tias cov ntaub ntawv rov ua dua kom raug.

4. Crutch

Kev piav qhia ntawm kev xav

Raws li koj tuaj yeem pom tom qab cov ntaub ntawv pib synchronizing (DFS), yog tias koj tsim ib yam dab tsi ntawm thawj tus neeg rau zaub mov, qee yam tsis muaj dab tsi tshwm sim ntawm tus neeg rau zaub mov thib ob, lossis nws tshwm sim tab sis qee zaus tsis tas li.

Tsis txhob poob siab; tau kawg, nws yuav tshwm sim sai dua lossis tom qab, tab sis zoo dua sai dua tom qab. Vim nws lig dhau 6-12 teev.

Qhov tshaj plaws yog tias sai li sai tau thaum koj tau tsim ib yam dab tsi ntawm thawj tus neeg rau zaub mov, ntawm qhov thib ob thiab tom qab servers cov ntaub ntawv yuav tshwm sim tam sim ua tsaug rau DFS system, tab sis yog tias cov ntawv xa ntawv no tau nyeem los ntawm ib tus neeg ua ntej. thiab tau thov dua, tus neeg rau zaub mov yuav tsis rov nyeem dua #msgs nplaub tshev tab sis yuav tawm cov ntaub ntawv los ntawm nws tus kheej qhov ntsuas, uas tej zaum yuav tsis sib haum rau peb qhov tseeb.

Kerio muaj cov txheej txheem rau rov nyeem qhov ntsuas, tab sis nws tuaj yeem ua haujlwm li ntawm rau teev, thiab thaum lub sijhawm 6 teev no, qhov cuam tshuam ntawm txoj haujlwm hauv daim ntawv qhia hnub yuav poob me ntsis.
Txhawm rau kuaj cov synchronization tam sim no, koj tuaj yeem rho tawm cov ntaub ntawv hauv qhov sib txuas synchronized directory index.fld, tom qab rov nkag mus rau cov ntawv tais ceev tseg ntawm tus xa ntawv thiab yog tias cov ntaub ntawv no ploj lawm, Kerio yuav rov nyeem cov npe thiab cov ntaub ntawv. yuav tshwm. Nws yuav zoo li tias qhov no yog kev daws teeb meem, rho tawm cov ntaub ntawv thaum cov ntaub ntawv hloov pauv, tab sis qhov no tsis ua haujlwm txhua lub sijhawm, tab sis tsuas yog thawj zaug, ces Kerio rau qee yam poob tag nrho cov paj hauv index.fld
Nws kuj tseem pib nti tawm cov lus uas tsis nkag siab rau tus neeg siv - txog qee yam kev ntsuas thiab nws twb ua qee yam nyob ntawd.

Muaj lwm txoj kev xaiv, los tsim ib yam dab tsi - thaum lub sijhawm tsim cov khoom tshiab, tus neeg rau zaub mov mam li nco dheev paub tias cov ntaub ntawv npe uas nws xav muab yog twb tau coj mus, tab sis nws snowballs thiab qhov no yog qhov kev xaiv kawg.

Yuav ua li cas?

Yog peb ua tib zoo saib ib zaug ntxiv rau daim duab uas twb paub lawm.

Tag nrho synchronization ntawm cov folders sib koom, kev sib cuag, daim ntawv qhia hnub ntawm kev faib Kerio Connect servers

Tab sis ntawm lwm lub dav hlau, koj tuaj yeem pom lub pob nthuav dav uas peb xav tau tam sim no - Reindex folders

Thiab qhov tseeb. Yog tias peb nyem rau ntawm lub pob no ntawm tus xa ntawv xa ntawv uas tsis paub tias ib yam dab tsi twb tau hloov pauv hauv synchronized #msgs, peb yuav tau txais qhov txiaj ntsig ruaj khov, nrawm. Txhua yam zais yuav ua kom pom tseeb.

Nyob rau hauv lub cav koj tuaj yeem pom ntev npaum li cas cov txheej txheem no siv sijhawm; hauv kuv rooj plaub nrog ntau txhiab (15 txhiab) cov ntaub ntawv nws yuav siv li 3-4 feeb.

Txhua yam peb yuav tsum tau ua yog xam seb yuav ua li cas thiaj nias lub pob no thaum peb xav tau.

Nws hloov tawm Kerio muaj lawv tus kheej API

piav qhia
Ntaub ntawv

Lub luag haujlwm uas ua peb txoj haujlwm zoo li no:
session = callMethod("Domains.checkPublicFoldersIntegrity",{}, token)

Los ntawm tag nrho cov saum toj no, peb yuav tsum tau sau ib tsab ntawv uas yuav saib xyuas lub xeev ntawm cov folders ntawm kev txaus siab thiab, yog hais tias ib yam dab tsi tau hloov, ua lub luag hauj lwm peb xav tau.

Kuv xav hais tias kuv tau sau ntau qhov sib txawv ntawm cov ntawv sau uas ua cov tshev sib txawv, thiab txiav txim siab rau ib qho uas kos tag nrho cov lus xaus raws li tus naj npawb ntawm cov ntaub ntawv.

Kev siv tsab ntawv

CMD tsab ntawv piv txwv thiab piav qhia

Re-index.bat

@echo off
set dir=%~dp0
%dir:~0,2%
CD "%~dp0"
md "%CD%LOG"
md "%CD%Setup"

ECHO -Start- >> "%CD%LOG%Computername%.log"
ECHO Start -> %Computername% %Date% %Time% >> "%CD%LOG%Computername%.log"

SetLocal EnableDelayedExpansion
for /f "UseBackQ Delims=" %%A IN ("%CD%Setup%Computername%.List") do (
  set /a c+=1
  set "m!c!=%%A"
)

set d=%c%
Echo Folder = %c%
ECHO Folder = %c% >> "%CD%LOG%Computername%.log"
ECHO.
ECHO. >> "%CD%LOG%Computername%.log"

:start
cls
if %c% LSS 1 exit
set /a id=1
set R=0

:Find
REM PF-Start
if "%id%" gtr "%c%" if %R% == 1 Goto Reindex 
if "%id%" gtr "%c%" timeout 60 && Goto start

For /F "tokens=1-3" %%a IN ('Dir "!m%id%!#msgs" /-C/S/A:-D') Do Set 2DirSize!id!=!DS!& Set DS=%%c
if "2DirSize!id!" == "" set 1DirSize!id!=!2DirSize%id%!

echo %id%
ECHO !m%id%!
echo Count        [ !1DirSize%id%! -- !2DirSize%id%! ]

if "!1DirSize%id%!" == "!2DirSize%id%!" ECHO Synk

REM DEL index.fld
if "!1DirSize%id%!" NEQ "!2DirSize%id%!" del /f /q !m%id%!index.fld && del /f /q !m%id%!indexlog.fld && del /f /q !m%id%!search.fld && set R=1 && ECHO RE-index Count && ECHO RE-index Count %Date% %Time% - Delete !m%id%! >> "%CD%LOG%Computername%.log"

set 1DirSize!id!=!2DirSize%id%!

ECHO.
ECHO.

set /a id+=1
goto Find

:Reindex
ECHO. >> "%CD%LOG%Computername%.log"
ECHO --- RE-INDEX - Start - %Date% %Time% --- >> "%CD%LOG%Computername%.log"
ECHO. >> ----------------------------------- >> "%CD%LOG%Computername%.log"
call PublicFolders.py
timeout 60
goto start

exit

Ib daim qauv ntawm tsab ntawv sau rau ntawm txhua tus neeg xa ntawv xa ntawv (yuav siv tau los ua kev pabcuam, tsis tas yuav muaj cai Adm)

Tsab ntawv nyeem cov ntaub ntawv Setup%Computername%.List

Qhov twg %Computername% yog lub npe ntawm tus neeg rau zaub mov tam sim no (Cov npe tuaj yeem muaj cov npe ntawm txhua tus servers ib zaug.)

Cov ntaub ntawv %Computername%.List - muaj tag nrho txoj hauv kev ntawm cov ntawv qhia synchronized, txhua txoj hauv kev sau rau ntawm kab tshiab, thiab yuav tsum tsis txhob muaj cov kab khoob.

Tom qab thawj zaug tso tawm, tsab ntawv ua cov txheej txheem indexing, tsis hais seb nws puas tsim nyog lossis tsis, thiab tsab ntawv kuj tsim qhov ntsuas ntawm cov ntaub ntawv hauv txhua phau ntawv synchronized.

Lub hom phiaj ntawm tsab ntawv yog suav tag nrho cov ntaub ntawv hauv phau ntawv teev npe.

Thaum kawg ntawm kev suav txhua phau ntawv teev npe, yog tias tsawg kawg ib phau ntawv teev npe tam sim no tus nqi ntawm cov ntaub ntawv tsis sib xws rau yav dhau los, tsab ntawv tshem tawm cov ntaub ntawv los ntawm cov hauv paus directory ntawm synchronized mail directory: index.fld, indexlog.fld, search.fld thiab pib cov txheej txheem indexing ntawm kev sib koom mail folders.

Cov ntaub ntawv hais txog kev ua haujlwm raug muab pov tseg rau hauv LOG directory.

Indexing txheej txheem
Cov txheej txheem indexing nqis los rau kev ua haujlwm Kerio API
Session = callMethod("Domains.checkPublicFoldersIntegrity",{}, token)

Ib qho piv txwv siv tau muab rau hauv - python
PublicFolders.py

import json
import urllib.request
import http.cookiejar
""" Cookie storage is necessary for session handling """
jar = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))
urllib.request.install_opener(opener)
""" Hostname or ip address of your Kerio Control instance with protocol, port and credentials """

server = "http://127.0.0.1:4040"
username = "user"
password = "password"

def callMethod(method, params, token = None):
    """
    Remotely calls given method with given params.
    :param: method string with fully qualified method name
    :param: params dict with parameters of remotely called method
    :param: token CSRF token is always required except login method. Use method "Session.login" to obtain this token.
    """
    data =  {"method": method ,"id":1, "jsonrpc":"2.0", "params": params}

    req = urllib.request.Request(url = server + '/admin/api/jsonrpc/')
    req.add_header('Content-Type', 'application/json')
    if (token is not None):
        req.add_header('X-Token', token)    

    httpResponse = urllib.request.urlopen(req, json.dumps(data).encode())

    if (httpResponse.status == 200):
        body = httpResponse.read().decode()
        return json.loads(body)

session = callMethod("Session.login", {"userName":username, "password":password, "application":{"vendor":"Kerio", "name":"Control Api-Local", "version":"Python"}})
token = session["result"]["token"]
print (session)

session = callMethod("Domains.checkPublicFoldersIntegrity",{"domainId": "test2.local"}, token)
print (session)

callMethod("Session.logout",{}, token)

http://127.0.0.1:4040 koj tuaj yeem tso nws raws li yog, tab sis yog tias koj xav tau HTTPS, python yuav tsum ntseeg daim ntawv pov thawj Kerio.

Tsis tas li ntawd nyob rau hauv cov ntaub ntawv koj yuav tsum tau qhia ib tug account nrog txoj cai los ua qhov no (Adm - pej xeem mail folders) ntawm lub mail server.

Kuv vam tias kuv tsab xov xwm yuav muaj txiaj ntsig zoo rau Kerio Connect cov thawj coj.

Tau qhov twg los: www.hab.com

Ntxiv ib saib