Forum

Geo balance code is broken

Paul 2016-03-20 18:35:56 UTC in WMSPanel functionality

I believe your Geo balance code has errors or is out of date.

https://github.com/WMSPanel/load-balancer/blob/master/geo-balancer/test.php

Around line 62,

These lines do not work and breaks script with syntax error, unexpected [ character
$balancer->setRegionServer(['JP','KR'], 'asia.example.com');

It took me about an hour of testing to find the error.
Bit I think this works:
$balancer->setRegionServer('JP','KR', 'asia.example.com');

So I guess, for sub regions you use square brackets [ ] ,
but for 2 digit country codes, there are no square brackets [ ] ?

Now I have fixed that and the runs, but it still does not work and do geo balance, the lines 100 (test links) always reverts to default server.

Paul 2016-03-20 18:39:54 UTC 

Can we have edit feature on forum?
"Now I have fixed that and the runs" lol. should say "Now I have fixed that and the script runs"

test.php lines 100 - 106 always echo the default server and do not get my country code from my IP.

Dmitry 2016-03-20 23:20:53 UTC 

Hello Paul,
this line is correct:
$balancer->setRegionServer(['JP','KR'], 'asia.example.com');
Reference code tested on PHP 5.5.30
Could you please check what return php -v?

Paul 2016-03-21 00:41:15 UTC 

Hi. its
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)

Alex Pokotilo 2016-03-21 00:50:17 UTC 

Please upgrade to 5.5 then

Paul 2016-03-21 15:40:39 UTC 

OK thanks guys. got it to work at last :)

Maybe put minimum version 5.5 on the Github guide?

For anyone else with centos:

yum update php didnt work
centos 6 only goes up to 5.3.
centos 7 goes to 5.4
so I followed this page https://www.mojowill.com/geek/howto-install-php-5-4-5-5-or-5-6-on-centos-6-and-centos-7/

My site is unavailable due to "DNS errors" after updating PHP. not sure what php has got to do with DNS! for now I access site via ip address. If anyone has any ideas what could be the problem with that?

Thanks

Paul 2016-03-21 15:45:40 UTC 

15 minutes later site works. Maybe cloudflare. I also clear cache on FF and site works.

Paul 2016-03-21 15:56:36 UTC 

For anyone else who might like this. Here is a list of country codes in CSV format.

I can sort data by region (eg, asia) copy/export the 2 digit codes & format somehow to add ' ', and paste in to geo balance script, saving a lot of time!

https://raw.githubusercontent.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.csv

Yury Udovichenko 2016-03-22 02:30:17 UTC 

Hi Paul,

Thank you for the feedback and updates.

Post a reply


Post a new question

Categories:

Tags:

nimbleNimble StreamerFAQHLSnimble streamerDVRRTMPhlsSRTsrtABRrtmpcacheNimblewmsauthAPItranscoderdvrffmpegapisldpudpVODaudioRTSPfailoverrtspDASHwmspanelUDPvodpaywallstreamingabrSLDPyoutubemp4DispersastreamerandroidsslmulticastLarixsubtitlesliveNDIvideolivestreamingplaylistWMSAuthMPEG-DASHpay-per-viewerrorgeoMPEG-TSre-streamingdashcorsWMSPaneledgebandwidththumbnaillarix broadcasterWindowshttpswhite labelconfigsmilFFMPEGencryptionCORSperformancechunksraspberry pimpeg-dashpublish controlcloudfrontDRMRepublishingvlcAWSS3advertisinguser agentadvertizerristrepublishingrules.confipv6MPEGTSFastSpringRecordingRAMwms panelfileFMLEVATcrossdomainSMILmpegtsaespushakamaimobilewowzaPullserverscodecmanifestSSLchromecastbalancedrmTranscodem3u8TranscoderbugWowzaIDreportingconfigurationsnapshotdownloadawsAndroidnimblestreamerdomaintranscoderaspianloopscte35streamroutesamazonupdateipVidillionHttpsmpeg-tsBroadcastplaylist_dvrVLCPIDerrorsEncoderoriginscte-35issuechunklimitsecurityLarix BroadcasterIPCDNthumbnailsUIRegistration Issuedirect link32-bit Windowstwitchcache_controlitworkmecudalive abr support mpeg-dashwmspanelapibeirutreloadWWDCdubaideep statsCentOS v6.4logIIS Smooth StreamingcloudmediaIPTVprofilelarix abrTSReaderAbrHTTPSHot-linking protectionHDSvaddioalertsMuxjwplayer websitewhmcsbaselinetimelineVaddioAV BridgePI3 Ubuntuview timeAuthentication in HLSNimble Streamer APIPi4streamsinterfacesHLS Meta Tag editing.encrytpionloadbalancingwmsattachmentHEVCmetadatamod_rewritewmsauthsignpricehighresourcehds streamOld logsciscolocalscreencastID3 tagsgbpsAxis.net hotlinkRTMP republishattaching domainssdpshoutcastno internetInterlacedocumentationofflinecontainerNimble streamer upgradeMulticast*concurrent-connectionsTrancoderrecordingrtmp abranalisysresumeniblerhls restreamingServer-siderestreamstoppedMPEG2TSNimble Streamer versionmainWMSCONFIG_HOMEdissapointmentdatmessagegentoo install server nimbletranscoding using NvidiaPublic IpPaywall AuthwildcardobsTCOno WMSPanelVideo Playertransocding republishingdecoderAliaspay per viewlost trafficdvr_archivesmpeg dashnginx rtmp nimbleRaspian Bustericecast urlexportopensslchangelimuxamazon web servicenginxPlayReadydvr stream twiceLarix GroveamfIOSAXVVGhot-linkExpression EncoderblocknvenconSteam stopped workingadaptiveAV1 codecHLS PlayerJWPLAYERNGINX-RTMPDASH PlayerHLS voddvr export to mp47analyticsapplicationpaywalbrandingtrialCablemicrosoft streamMP4rocksoftlog traffic statsjpegscreen freezecan't registeraccuracyprivate networkLarge DVR fileslive videodebianTelegraminterleavingSLDP PLayerseekingmac osx installwotermarklive video on demandbandwithnimblesessionidFFmpegmultiple originsvimeohelp errorserverload balancezabbixheadercache expirycdnvsomlog nimble analysertmp playbacklive streamsourceViewer StatsAdsvideojsLive Streamingbitrate#restreamMP4 not playedspaceServer-Side-Task-Controlvideo stopaes encryptionsubscriptionvod no soundconcurrent connectionlebanonlocationdvr streamconnectivityUbuntu 20 ARM - AWSunique visitorstereo to monoscreen capturelive pull settingsWMSPanel settingsABR HLS Bitratesrtmp for YouTube4Kcrossdomain more then 1 domainWidevineFairplaycpunot foundCPU LoadpullAS3loggingnimble streamer vod hls transmuxingbuttAWS 3Cross Domaininsert logoinstall players setup ready to goDVRSettingstwitch larix broadcaster androidicecast metadataDVRStreamsAppleDelete recordspremium featureControl APIProgressivenimble streamer web server php script pageautomationLive streamingvideo loopUbuntu artful 17.10Transcoder MPEG DASHinvalidMPEG DASHstarttime duration seekpointadd_chunk failedPost processingfake extensionstatus:errorrebootdroppingmobile app live streamingmonitoroutrateudp streamingapi accessDeep statsicecastMPEG-Dashloadbalancerweb playercontent-dispositionpaymentstatsNimble ServerAVCaptureMovieFileOutputblock downloadrestartdvr streamsavoid refreshlivestreamABR DVR problemNimble CapacityHotlinking ProtectionStreaming routehotlinkfacebookcontentRTMP RepublishSecurityLive Switcherdemandnot to stealLive BroadcastMultiple Audio trackssecure streaminglow_bandwidthwmsAuthSignnimble streamer mpeg-ts multiple inputsLoad-Balancingvp9adsounddisk migrationThumbnailsserver incorrect timeLIVELivelearnernimble webcam html5ssaiDVR Setting limitpausemosaicHow to do live stream with multiple audio trackrmtptranscoder nimblereportsdvr on wmspanelfpsVideo cant be playedS3 AWSraspberryPaywalllivestreamintransocderstorage space availablediskcredentialsdvr to livewebhookautomateuser_agentvbv-maxratedomain lockUsers limitoutputcloudflareVOD HLS streaming on public IPlarixscteInvalid frame headerno soundincoming streamSubtitleslivestream bitratedockerDVRRecordingAuthGopDVR SettingPORTdelaympeg4storagealias route.movartifactsrtsp push androidmultiviewRAM Loadhttp serverLatencywirecasta recordruleshow-tomanage_dvrError when installingVP9server ip21Nimble connectionsabr fallbackno audiolatencyaliasdata slicesplayer sldpmp2 audioNimble streamerfastspringsoftware versionadjustSO_RCVBUFbuffering videodistributionbufferqataritworkscdnvideo.jsmultiplexcompatibility protocolsCentos 8pay-per-minuteTeradek Decoderubuntu 183.6.1-1UDP MulticastMax connectionincomingmulti-viewerFallbackhelpmultiple audio udphotlink protectionRaspberryPi4ultra low latencyaws amazonhls to multicast udpnoobSSL requestsha265broadcasterOSXmd5analyseStreamIDprerollnimble on cloudrtmp sldp nimblepluginfallbacktasks-controlRaspberryRTMP to SRTLinuxgpu{stream}Connections count limitNimble_Crushwebrtc4GRIST Bondingplayoutsrt-live-transmitWowza AgentRemote StorageSSAItuningAmazonTVfireOBSvideo and audio not matchLarix broadcasterNetworkspeedup my videoiOSPerformanceSnapshotsSRT RTMPre-publishingletsencryptTonydowntranscodingFFMPEG;RTMP;I/O errorLL-HLSHTML5 playerAddendaABR DASHprogressive downloadeventLL-HLS DVRav1 codecconnectionsNimbleStreamernimble aliasesNimble StreambuildABR bitratesPacketizingcountrist set fecmultiple audioOBS StudioWMSAUTHIVSDelaympeg2tsIIS Media Servicsrtmp republishing transcodenimble.confinterfacetrackbindprogressivebroadcast videovideo audioSRT protocoldvbduplicatingpcdynamic linksTLSV 1.2 CertificatesubfolderbrowserurlGoogle DriveHLS Streamingrtmpscostnimble abr hlsthumbnail dvr-thumbnailaudio languageVR-360Failovergoogle cloud storagepricingoverlayhot linkingTRANSCODErtpnimble dvrBandwidthdurationYadifportsRokuContinuitywordpressJetson NanoSecureLarix PlayerramfairplayNginxpublish streamStream Delayhd25trafficAArch64video streamingQuickTimeCloud StorageRistmultistreamingmultipleserver ssl erroractionscript 3dropped framesCSSMPEG2 VideoPCRlogo in streammultipointrulerepublishconcurrent

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the Privacy Policy. If you want to know more or withdraw your consent to all or some of the cookies, please refer to the Privacy Policy.
By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to the use of cookies.