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 streamerDVRRTMPhlsABRcacheNimbleSRTsrtrtmpwmsauthdvrAPIapitranscoderffmpegVODfailoverudpDASHsldpstreamingrtspRTSPwmspanellivevodUDPmp4paywallabrsubtitlesDispersaSLDPmulticastvideoyoutubelivestreamingWMSAuthMPEG-DASHpay-per-viewgeoaudiodashstreameredgeWMSPanelbandwidththumbnailWindowsencryptionhttpswhite labelconfigplaylistsmilsslFFMPEGMPEG-TSCORSre-streamingmpeg-dashchunksraspberry pipublish controlperformancecorscloudfrontDRMRepublishingadvertizerrepublishingvlcS3user agentandroidLarixNDIrules.confadvertisingipv6MPEGTSFastSpringRAMFMLEVATcrossdomainSMILmpegtsRecordingaespushakamaiwowzamobileserversPullcodecbalanceerrorTranscodem3u8SSLchromecastplaylist_dvrWowzaconfigurationIDbugreportingdownloadsnapshotLarix BroadcasterAndroidnimblestreamerdomainmpeg-tsloopraspianwms panelchunkAWSVidillionHttpsoriginawsCDNroutesipupdatescte35amazonIPUInimble webcam html5Registration Issuedirect link32-bit Windowstwitchcache_controlitworkmelive abr support mpeg-dashwmspanelapiresumertmp abrbeirutWWDCdubaideep statsCentOS v6.4hls to multicast udpnooblogRemote StorageWowza AgentIIS Smooth StreamingcloudmediaAbrHTTPSHot-linking protectionHDSvaddioalertsjwplayer websitewhmcsbaselinetimelinenginx rtmp nimbledurationAV BridgeVaddioAuthentication in HLSPI3 UbuntuPi4view timepriceresourceNimble Streamer APIlimitOld logsscte-35screencastinterfacesDVRRecordingloadbalancingmod_rewritemetadataattaching domainsprofileAxisgbpsID3 tagscontainerwmsauthsignhighhds streamlocalciscodatmessageWMSCONFIG_HOMErestreamcost.net hotlinkgentoo install server nimblePublic Iptranscoding using NvidiaPaywall Authhls restreamingofflinedocumentationNimble streamer upgradeVLCTrancoderconcurrent-connectionsfileniblerServer-sideVideo Playertransocding republishingdecoderstoppedNimble Streamer versionAliasmainlost trafficlebanonlocationmanifesticecast urlMP4 not playedspacepay per viewrulehot linkingdvr_archivesmpeg dashchangeseekingwildcardobsTCORaspian BusterexportopensslamfLarix GrovenginxPlayReadyamazon web servicelimuxdvr stream twicesdpshoutcastrepublishonSteam stopped workinghot-linkAXVVGExpression EncoderHLS vodblocknvencHLS Playeranalyticspaywalapplication7DASH Playerbrandingtrialmicrosoft streamMP4errorsjpegrocksoftlog traffic statsdebianscreen freezecan't registernimblesessionidFFmpegmultiple originsprivate networkLarge DVR fileslive video on demandABR DASHprogressive downloadbandwithno WMSPanelserverlive videoheaderinterleavingSLDP PLayermac osx installlog nimble analysertmp playbackvideojswotermarksourcevimeohelp errorbitrate#restreamload balanceadaptiveAV1 codecJWPLAYERNGINX-RTMPcache expiryvideo stopcdnvsomlive streamViewer Statsstreams4Kcrossdomain more then 1 domainattachmentDelaympeg2tscpuServer-Side-Task-Controlvod no soundconcurrent connectiondisk migrationdvr streamconnectivityUbuntu 20 ARM - AWSunique visitordvr on wmspanelscreen capturestereo to monobuttAWS 3drmaes encryptionWidevinesubscriptionControl APIFairplayTranscoderLive streamingWMSPanel settingslive pull settingsABR HLS Bitratessecurityrtmp for YouTubenot foundCPU Loadpulladd_chunk failedPost processingfake extensionAS3udp streamingoutrateinstall players setup ready to goDVRSettingstwitch larix broadcaster androidAppleDelete recordsicecastnimble streamer vod hls transmuxinglogginglearnerinsert logovideo loopstarttime duration seekpointrebootAVCaptureMovieFileOutputblock downloadmonitordvr streamsnimble.confrtmp republishing transcodeIIS Media Servicstracknimble streamer web server php script pageautomationlivestreamapi accessDeep statsloadbalancerNimble CapacityABR DVR probleminvalidMPEG DASHUbuntu artful 17.10Transcoder MPEG DASHweb playerLive Switchercontent-dispositionnot to stealLive Broadcaststatus:errortranscodingdownFFMPEG;RTMP;I/O errorNimble ServerMPEG-Dashlarix broadcasterfacebookStreaming routeHotlinking ProtectionRTMP republishbroadcasterOSXpaymentstatsreloadadvp9contentRTMP RepublishdemandssaiDVR Setting limitpremium featureserver incorrect timeThumbnailsIOSLiveLIVErmtpno internetHLS StreamingLoad-Balancingnimble streamer mpeg-ts multiple inputswmsAuthSignHow to do live stream with multiple audio tracksoundHLS Meta Tag editing.Progressivenimble aliasesavoid refreshraspberrythumbnail dvr-thumbnailPaywalltranscoder nimblereportscredentialstranscodevbv-maxrateSecureJetson NanoFailoverVR-360ABR bitratesPacketizingbuildpublish streamStream Delaytraffichd25AArch64S3 AWSVideo cant be playeduser_agentautomatedelaympeg4.movalias routestoragedomain lockVOD HLS streaming on public IPoutputUsers limitcloudflarelivestream bitratedockeranalisysscteInvalid frame headerno soundincoming streamHTML5 playerGopLL-HLS DVRav1 codecNimbleStreamerfastspringNimble streamermp2 audiodata slicesaliasplayer sldpdistributionwirecasta recordhttp serverqataritworkscdnvideo.jsRAM Load*VP9abr fallbackNimble connectionsissuepricinggoogle cloud storagelatencybuffering videoSO_RCVBUFbufferCentos 8dissapointmentpay-per-minutelivestreamintransocderspeedup my videoiOSmultiplexcompatibility protocolsdiskstorage space available3.6.1-1server ip21SSL requestMax connectionUDP Multicastsha265md5multi-viewerincomingDVR SettingPORTanalyseStreamIDnimble dvrrtpBandwidthportsrulesError when installinghow-tomanage_dvrDVRStreamsaws amazonRIST BondingplayoutMPEG2 Videologo in streammultiple audio udphotlink protectionRaspberryPi4ultra low latencynimble on cloudrtmp sldp nimbleprerollwebhookdvr to liveprogressivebroadcast videoQuickTimevideo streamingartifactsrtsp push androidtuningCross DomainSRT protocolvideo audio4GwebrtcNimble_CrushTeradek Decoderubuntu 18restarthelpFallbackPIDurlLinuxRTMP to SRTTLSV 1.2 Certificatedynamic linksSnapshotsfallbackthumbnailsLarix broadcastervideo and audio not matchdvbNetworkBroadcastRaspberrytasks-control{stream}gpuactionscript 3server ssl errorCSSRistmultiplefairplayNginxOBSadjustsoftware versionSRT RTMPre-publishingmultiple audio

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.