F5BIG-IP의 iRule LX의 node입니다.js를 사용할 수 있을 것 같으니 우선 Hello World부터 (pa와 3)

5542 단어 Node.jsbig-ip
일단 BIG-IP Virtual Server에 iRule을 붙여서 확인을 해볼게요.
(Virtual Server의 제작은 여기서 생략합니다.여기.에서 제작한 것입니다.)
그것까지 제작된'아울렉스 헬로월드'링크를 만들었어요.

Virtual Server에 액세스한 후
일지에 기록하다.

아래 서술한 내용에 근거하다
Getting Started with iRules LX, Part 1: Introduction & Conceptual Overview
Unlike iRules which has a TCL interpreter running inside the Traffic Management Micro-kernel (TMM), Node.js is running as a stand alone processes outside of TMM. Having Node.js outside of TMM is an advantage in this case because it allow F5 to keep the Node.js version more current than if it was integrated into TMM.
In order to get data from TMM to the Node.js processes, a Remote Procedural Call (RPC) is used so that TMM can send data to Node.js and tell it what "procedure"to run. The conceptual model of iRules LX looks something like this -

Node.js는 TMM(TMM과 BIG-IP와 유사한 독립 프로세스) 이외의 독립 프로세스로 실행되며,
TMM 및 노드js 사이에 원격 프로세스 호출(RPC)이 있는데 데이터를 수발할 수 있습니까?
TMM은 Node입니다.js에 데이터를 보내서 실행할 과정을 알려 줍니다.호, Node.js에서 받은 데이터가 무엇을 실행하는지에 따라 얻은 정보는 RPC를 통해 TMM에 전달된다.그런 거 알아요?( ˘•ω• )
iRule → rpc → node.js → rpc → iRule
이런 인상?
다음을 예로 들다.
irulelx_Helloworld.irule
 when HTTP_REQUEST {
   set ClientAddress [IP::client_addr]
   log local0.info "(^^)v OK----!"
   set rpc_handle [ILX::init Lxpi_Helloworld Lxex_Helloworld]
   set result [ILX::call $rpc_handle Hello_method $ClientAddress]

   if { $result eq "Hello" } {
      log local0.info "(^^)v Hello!"
   } else {
      log local0.info "(--)v No..."
   } 
}
set ClientAddress [IP::client_addr]
※ 변수 "Client Address"에 클라이언트 IP 주소 설정
log local0.info "(^^)v OK----!"
※ "log local 0. info"를 통해 로그 출력
set rpc_handle [ILX::init Lxpi_Helloworld Lxex_Helloworld]
※ "ILX::init"를 통해 iRule LX 플러그인과 iRule LX Extention의 RPC 제어점, 변수 rpc 만들기handle에 저장
set result [ILX::call\$rpc_hdl my_method\$arg1]
※ "ILX:::call"을 사용하여 "Hello method"와 "Client Address"를 RPC 핸들에 전달하고, 결과를 변수 "result"에 저장
※'my method'는 노드입니다.js에서 실행하는 과정 중
※ 변수 "arg1"을 함께 건네준다.
if { $result eq "Hello"} {
※ Node.js에서 실행된 처리 결과는 변수'result'이기 때문에 결과가'Hello'일 경우
log local0.info "(^^)v Hello!"
※ 일지 "(^^) v Hello 𐁆;;;;출력
index.js
ilx.addMethod('Hello_method', function(req, res){
  var data = req.params()[0];

  console.log("Node.js $date")

  res.reply('Hello');
});
ilx.addMethod('Hello_method', function(req, res){
※ 첫 번째 매개변수'Hello method'는 iRule에서 호출된 메서드의 이름이며, 두 번째 매개변수는 mymethod를 호출할 때 실행되는 호출 함수입니다.
var data = req.params()[0];
※ 아이룰에서 받은 변수의 첫 번째 삽입
console.log("Node.js $date")
※ 일지로 출력
res.reply('Hello');
※ "Hello"를 아이룰로 되돌려줍니다.
이런 절차입니까?
그러니까 해봐--!봉화ω・`)੭ु⁾⁾
iRule에 붙여넣기

index.js에 붙여넣기

Virtual Server에 액세스한 후
출력 오류01220001:3: TCL error: /Common/Lxpi_Helloworld/irulelx_Helloworld <HTTP_REQUEST> - Could not find ILX extension Lxex_Helloworld in path Lxpi_Helloworld (line 3) invoked from within "ILX::init Lxpi_Helloworld Lxex_Helloworld"index.js의 첫 줄에 f5-nodejs 모듈과 RPC 서버의 감청이 추가되었습니다.
index.js
/* Import the f5-nodejs module.*/
var f5 = require('f5-nodejs');

/* Create a new rpc server for listening to TCL iRule calls. */
var ilx = new f5.ILXServer();
ilx.listen();


ilx.addMethod('Hello_method', function(req, res){
  var data = req.params()[0];

  console.log("Node.js $date")

  res.reply('Hello');
Virtual Server에 다시 액세스

아!오케이인 것 같아!
그럼 index.js→→ iRule에게 건네준 값을'Hello'가 아닌'good morning'으로 바꿔라!

동시에 Virtual Server에 액세스하십시오!!
될 것 같아요.(--)v No...되다🎶

좋은 웹페이지 즐겨찾기