Forum Discussion

235's avatar
235
Icon for Nimbostratus rankNimbostratus
Jun 20, 2018

Use iRules-LX to Blue/Green Deployment

Hello I've been learning IRules-LX,I hope to get http post username through iRules,Then used the username call to node.js(mysql npm) select mysql database.if the username select result is "green".loadbalance to green pool. Or else loadbalance to blue pool.

 

Has anyone ever tested it ? Is there an I/O bottleneck?

 

Thanks everyone

 

5 Replies

  • 235's avatar
    235
    Icon for Nimbostratus rankNimbostratus

    Hello everyone My Irules is below:

     

    when HTTP_REQUEST { if { [HTTP::username] ne "" } { log local0. "User [HTTP::username] has been authorized to access virtual server [virtual name]" Client supplied a valid username, so initialize the iRulesLX extension

     

    set RPC_HANDLE [ILX::init "iruleslx_mysql_plugin" "mysql_extension"] set username [HTTP::username] set rpc_response [ILX::call $RPC_HANDLE myql_nodejs $username $static::mysql_debug]

     

    set rpc_response [ILX::call $RPC_HANDLE myql_nodejs $username]

     

    Send an HTTP 200 response with the groups retrieved from the iRulesLX plugin

     

    HTTP::respond 200 content "\nGroup(s) for '$username' are '$rpc_response'\n"

     

    HTTP::respond 200 content "User Database$rpc_response "

     

    log local0. "Looked up \$username=$username and matched group(s): $rpc_response" } else { HTTP::respond 401 WWW-Authenticate "Basic realm=\"Secured Area\"" } }

     

    But My /var/log/ltm desplay erro log :Jun 21 15:22:12 v13 err tmm[28004]: 01220001:3: TCL error: /Common/iruleslx_mysql_plugin/mysql_irulelx - Could not find ILX extension mysql_extension in path iruleslx_mysql_plugin (line 4) invoked from within "ILX::init "iruleslx_mysql_plugin" "mysql_extension"" How to troubleshotting ?

     

    Thanks

     

    • First of all, I don't think you need the double qoutes. Just use:

      set RPC_HANDLE [ILX::init iruleslx_mysql_plugin mysql_extension]
      

      It seems you are not calling the right extension. What does the following command returns?

      tmsh list ilx plugin iruleslx_mysql_plugin
      
    • 235's avatar
      235
      Icon for Nimbostratus rankNimbostratus

      Hi Niels van Sluis

       

      Thanks for your reply.My tmsh comamnd output is below:

       

      [root@v13:Active:Standalone] config tmsh list ilx plugin iruleslx_mysql_plugin ilx plugin iruleslx_mysql_plugin { extensions { mysql_extension { } } from-workspace iruleslx_mysql_workspace log-publisher local-db-publisher node-version 6.9.1 staged-directory /var/ilx/workspaces/Common/iruleslx_mysql_workspace }

       

    • Not sure why it doesn't work in your case. I just setup something similar in my lab running 13.1.0.6 and it just works.

      root@(nielsvs-bigip)(cfg-sync Standalone)(Active)(/Common)(tmos) list ilx plugin 
      iruleslx_mysql_plugin 
      ilx plugin iruleslx_mysql_plugin {
          extensions {
              mysql_extension { }
          }
          from-workspace iruleslx_mysql_workspace
          log-publisher local-db-publisher
          node-version 6.9.1
          staged-directory /var/ilx/workspaces/Common/iruleslx_mysql_workspace
      }
      root@(nielsvs-bigip)(cfg-sync Standalone)(Active)(/Common)(tmos) quit
      [root@nielsvs-bigip:Active:Standalone] config  ls -la /var/ilx/workspaces/Common/iruleslx_mysql_workspace/extensions/mysql_extension/
      total 20
      drwxrwxr-x. 3 root sdm 4096 2018-06-24 16:35 .
      drwxrwxr-x. 3 root sdm 4096 2018-06-24 16:35 ..
      -rw-rw-r--. 1 root sdm  951 2018-06-24 16:38 index.js
      drwxrwxr-x. 3 root sdm 4096 2018-06-24 16:35 node_modules
      -rw-rw-rw-. 1 root sdm  381 2018-01-16 17:45 package.json
      [root@nielsvs-bigip:Active:Standalone] config 
      

      Does

      tmsh show ilx plugin iruleslx_mysql_plugin
      shows that the extension is running?

      [root@nielsvs-bigip:Active:Standalone] config  tmsh show ilx plugin iruleslx_mysql_plugin | grep -B 2 Status
        | Extension: mysql_extension
        -------------------------------
        | Status                running
      --
           | Extension Process: mysql_extension
           ------------------------------------------
           | Status                running
      --
           | Extension Process: mysql_extension
           ------------------------------------------
           | Status                running
      [root@nielsvs-bigip:Active:Standalone] config