Apache Ignite Zero Deployment: Tiag Zero?

Apache Ignite Zero Deployment: Tiag Zero?

Peb yog lub chaw tsim khoom siv thev naus laus zis ntawm lub khw muag khoom network. Muaj ib hnub, kev tswj hwm tau teeb tsa txoj haujlwm ntawm kev ua kom cov kev suav loj loj los ntawm kev siv Apache Ignite ua ke nrog MSSQL, thiab pom lub vev xaib nrog cov duab zoo nkauj thiab cov piv txwv ntawm Java code. Kuv tam sim ntawd nyiam qhov chaw Zero Deployment, cov lus piav qhia uas tau cog lus ua txuj ci tseem ceeb: koj tsis tas yuav siv koj tus kheej Java lossis Scala code ntawm txhua qhov ntawm daim phiaj thiab rov xa nws txhua zaus nws hloov. Raws li kev ua haujlwm tau nce mus, nws tau pom tias Zero Deployment muaj kev siv tshwj xeeb, cov yam ntxwv uas kuv xav qhia. Hauv qab qhov txiav yog cov kev xav thiab cov ntsiab lus ntawm kev siv.

1. Nqe lus hais txog qhov teeb meem

Lub ntsiab ntawm txoj hauj lwm yog raws li nram no. Muaj SalesPoint cov chaw muag khoom thiab Sku (Stock Keeping Unit) cov npe khoom. Lub ntsiab lus ntawm kev muag khoom muaj "Khoom hom" tus cwj pwm nrog cov txiaj ntsig "me" thiab "loj". Ib qho assortment (daim ntawv teev cov khoom ntawm qhov chaw muag khoom) yog txuas nrog txhua qhov chaw muag khoom (loaded los ntawm DBMS) thiab cov ntaub ntawv tau muab los ntawm hnub teev cov khoom teev.
cais tawm ntawm assortment lossis ntxiv rau assortment.

Nws yog ib qho tsim nyog los npaj ib qho kev faib tawm ntawm cov ntsiab lus ntawm kev muag khoom thiab khaws cia rau hauv nws cov ntaub ntawv hais txog cov khoom sib txuas rau ib hlis ua ntej. Kev sib raug zoo nrog cov kev sib ntaus sib tua yuav tsum muaj Ignite tus neeg siv khoom thauj cov ntaub ntawv, suav ib qho kev sib sau ntawm daim ntawv (khoom hom, Cov khoom lag luam, hnub, naj npawb_of_sales_points) thiab xa rov qab mus rau DBMS.

2. Kawm tej ntaub ntawv

Kuv tseem tsis tau muaj kev paub, yog li kuv pib seev cev los ntawm qhov cub. Ntawd yog, los ntawm kev tshuaj xyuas cov ntawv tshaj tawm.

Tshooj 2016 Qhia Apache Ignite: Thawj kauj ruam muaj qhov txuas mus rau cov ntaub ntawv ntawm Apache Ignite qhov project thiab tib lub sijhawm hais lus thuam rau qhov tsis meej pem ntawm cov ntaub ntawv no. Kuv rov nyeem nws ob peb zaug, clarity tsis tuaj. Kuv xa mus rau lub official tutorial pib, uas
optimistically cog lus tias "Koj yuav sawv thiab khiav hauv jiffy!" Kuv tab tom txheeb xyuas qhov chaw hloov pauv ib puag ncig, saib ob Apache Ignite Essentials cov yeeb yaj kiab, tab sis lawv tsis muaj txiaj ntsig zoo rau kuv txoj haujlwm tshwj xeeb. Kuv ua tiav Ignite los ntawm kab hais kom ua nrog cov ntaub ntawv txheem "example-ignite.xml", tsim thawj daim ntawv thov Daim ntawv thov suav siv Maven. Daim ntawv thov ua haujlwm thiab siv Zero Deployment, zoo nkauj npaum li cas!

Kuv nyeem ntxiv, thiab muaj qhov piv txwv tam sim ntawd siv affinityKey (tsim ua ntej los ntawm SQL query), thiab txawm siv qhov tsis meej BinaryObject:

IgniteCache<BinaryObject, BinaryObject> people 
        = ignite.cache("Person").withKeepBinary(); 

kuv nyeem nws ib me ntsis: binary hom - ib yam dab tsi zoo li kev xav, nkag mus rau thaj chaw ntawm ib qho khoom los ntawm lub npe. Muaj peev xwm nyeem tus nqi ntawm ib daim teb yam tsis tas deserializing cov khoom (txuag nco). Tab sis yog vim li cas BinaryObject siv es tsis txhob ntawm tus neeg, txij li thaum muaj Zero Deployment? Vim li cas IgniteCache Hloov mus rau IgniteCache ? Nws tseem tsis tau meej.

Kuv tabtom remaking daim ntawv thov Compute kom haum kuv rooj plaub. Lub ntsiab tseem ceeb ntawm cov npe ntawm cov ntsiab lus ntawm kev muag khoom hauv MSSQL txhais tau tias yog [id] [int] TSIS NULL, Kuv tsim lub cache los ntawm kev sib piv

IgniteCache<Integer, SalesPoint> salesPointCache=ignite.cache("spCache")

Hauv xml config kuv qhia tias cache tau muab faib

<bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name" value="spCache"/>
    <property name="cacheMode" value="PARTITIONED"/>
</bean>

Kev faib tawm los ntawm kev muag khoom xav tias qhov xav tau sib sau ua ke yuav raug tsim los ntawm txhua pawg ntawm cov khoom muagPointCache cov ntaub ntawv muaj nyob rau ntawd, tom qab ntawd tus neeg siv khoom yuav ua qhov kawg qhov kawg.

Kuv nyeem cov lus qhia Thawj Ignite Compute Application, Kuv ua nws los ntawm kev sib piv. Ntawm txhua pawg node kuv khiav IgniteRunnable(), qee yam zoo li no:

  @Override
  public void run() {
    SalesPoint sp=salesPointCache.get(spId);
    sp.calculateSalesPointCount();
    ..
  }

Kuv ntxiv aggregation thiab uploading logic thiab khiav nws ntawm cov ntaub ntawv xeem. Txhua yam ua haujlwm hauv zos ntawm kev txhim kho server.

Kuv tso ob lub CentOs xeem servers, qhia qhov chaw nyob IP hauv default-config.xml, ua rau txhua tus

./bin/ignite.sh config/default-config.xml

Ob lub Ignite nodes khiav thiab tuaj yeem pom ib leeg. Kuv qhia meej qhov chaw nyob xav tau hauv xml config ntawm daim ntawv thov tus neeg siv khoom, nws pib, ntxiv ib qho thib peb ntawm lub topology thiab tam sim ntawd muaj ob qhov ntxiv. Lub cav qhia "ClassNotFoundException: model.SalesPoint" nyob rau hauv kab

SalesPoint sp=salesPointCache.get(spId);

StackOverflow hais tias yog vim li cas rau qhov yuam kev yog tias tsis muaj kev cai SalesPoint chav kawm ntawm CentOs servers. Peb twb tuaj txog lawm. Yuav ua li cas hais txog "koj tsis tas yuav siv koj tus lej Java ntawm txhua qhov" thiab lwm yam? Los yog "koj Java code" tsis hais txog SalesPoint?

Tej zaum kuv tsis nco ib yam dab tsi - Kuv pib tshawb nrhiav dua, nyeem thiab tshawb nrhiav dua. Tom qab ib pliag, kuv tau txais kev xav tias kuv tau nyeem txhua yam ntawm lub ncauj lus, tsis muaj dab tsi tshiab ntxiv lawm. Thaum kuv tab tom nrhiav, kuv pom qee cov lus nthuav tawm.

Valentin Kulichenko, Lead Architect ntawm GridGain Systems, teb ntawm StackOverflow, Plaub Hlis 2016:

Model classes are not peer deployed, but you can use withKeepBinary() flag
on the cache and query BinaryObjects. This way you will avoid deserialization
on the server side and will not get ClassNotFoundException.

Lwm qhov kev xav pom zoo: Denis Magda, Tus Thawj Coj ntawm Kev Tswj Xyuas Khoom, GridGain Systems.

Kab lus ntawm Habre hais txog microservices hais txog peb tsab xov xwm los ntawm Denis Magda: Microservices Part I, Microservices Part II, Microservices Part III 2016-2017. Nyob rau hauv tsab xov xwm thib ob, Denis qhia pib ib pawg ntawm cov MaintenanceServiceNodeStartup.jar. Koj tseem tuaj yeem siv lub community launch nrog xml teeb tsa thiab kab hais kom ua, tab sis tom qab ntawd koj yuav tsum tau muab cov chav kawm kev cai ntawm txhua qhov siv pawg ntawm pawg:

That's it. Start (..)  node using MaintenanceServiceNodeStartup file or pass
maintenance-service-node-config.xml to Apache Ignite's ignite.sh/bat scripts.
If you prefer the latter then make sure to build a jar file that will contain
all the classes from java/app/common and java/services/maintenance directories.
The jar has to be added to the classpath of every node where the service
might be deployed.

Tseeb, yog nws. Ntawm no nws hloov tawm, yog vim li cas, qhov no mysterious binary hom!

3.SingleJar

Denis yog thawj qhov chaw hauv kuv tus kheej kev ntaus nqi, IMHO qhov kev qhia tseem ceeb tshaj plaws ntawm txhua yam muaj. Hauv nws MicroServicesExample Github muaj cov piv txwv npaj txhij ua tiav ntawm kev teeb tsa pawg nodes, uas suav nrog yam tsis muaj squatting ntxiv.

Kuv ua nws ib yam nkaus thiab tau txais ib lub thawv ntawv uas tso tawm "cov ntaub ntawv node" lossis "tus neeg siv khoom" nyob ntawm cov kab lus hais kom ua. Kev sib dhos pib thiab ua haujlwm. Zero Deployment tau swb lawm.

Kev hloov ntawm megabytes ntawm cov ntaub ntawv xeem mus rau kaum tawm gigabytes ntawm kev sib ntaus sib tua cov ntaub ntawv tau pom tias hom ntawv binary tshwm sim vim li cas. Nws yog ib qho tsim nyog los ua kom zoo dua kev nco txog ntawm cov nodes, thiab qhov no yog qhov twg BinaryObject tau ua kom muaj txiaj ntsig zoo.

4. Cov lus xaus

Thawj qhov kev thuam tau ntsib txog qhov tsis meej pem ntawm Apache Ignite cov ntaub ntawv qhov project tau ua kom ncaj ncees; me me tau hloov txij li xyoo 2016. Nws tsis yog ib qho yooj yim rau tus pib los sau cov qauv ua haujlwm raws li lub vev xaib thiab / lossis chaw cia khoom.

Raws li cov txiaj ntsig ntawm kev ua haujlwm tau ua tiav, lub tswv yim yog tias Zero Deployment ua haujlwm, tab sis tsuas yog nyob rau theem system. Tej yam zoo li no: BinaryObject yog siv los qhia tej thaj chaw deb pawg los ua haujlwm nrog cov chav kawm kev cai; Zero Deployment - internal mechanism
Apache Ignite nws tus kheej thiab faib cov khoom siv thoob plaws hauv pawg.

Kuv vam tias kuv qhov kev paub dhau los yuav muaj txiaj ntsig zoo rau cov neeg siv Apache Ignite tshiab.

Tau qhov twg los: www.hab.com

Ntxiv ib saib