336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Windows Network Load Balancing (VirtualBox & Windows2012) #3



이제 Windows Network Load Balancing 설정을 해보겠습니다.





이런 형태의 구성이 될 겁니다.







1. AppTest1 에서 Cluster 를 만들기 위해 첫번째 Host 인 192.168.20.11 를 검색 합니다.




 

 

2. 추가된 Host 확인


 

 

 

 

 

 

 

 

 

 

 

 

 



 

 

 

 

 

 

3. Cluster IP 로 사용할 IP를 추가


 

 

 

 

 

 

 


 

 

 

 

 

 

 4. Cluster IP 입력


 

 

 

 

 

 

 



 

 

 

 

 

 

 5. Edit 하여 Cluster Operation Mode 변경

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 6. Port Rules 변경


 

 

 

 

 

 


 

 

 

 

 

 

 

 

 7. Fitering Mode -> Multiple Host : None 선택

 

 

 

 

 


 

 

 

 

 

 

 8. Finish


 

 

 

 

 

 

 


 

 

 

 

 

 9. AppTest1(192.168.20.11)이 Cluster IP(192.168.20.13)으로 설정된 것이 보입니다.


 

 

 

 

 

 

 

 


 

 

 

 

 

 10. AppTest2(192.168.20.12)을 Cluster 에 Host 로 추가해보겠습니다.

 

 

 

 

 

 

 

 


 

 

 

 

 

  11. AppTest2(192.168.20.12)을 검색


 

 

 

 

 

 

 

 


 

 

 

  10. AppTest2(192.168.20.12)을 선택


 

 

 

 

 

 

 

 

 

 


 

 

 

 

  11. IP 확인


 

 

 

 

 

 

 

 

 


 

 

 

 

 

 


 

 

 

 

 

 

 


 

 

 

    12. Port Rule 확인


 

 

 

 

 

 

 

 

 

 


 

 

 

     13. 이제 추가되어 Pending 중 입니다. 


 Virtual Box 라 그런지.... 시간이 좀 걸립니다.







이제 설정은 모두 끝났습니다.







336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Windows Network Load Balancing (VirtualBox & Windows2012) #2



이제 VirtualBox 의 AppTest1, AppTest2 를 설정해보겠습니다.




1. 공통설정








1.1 Server Manager 를 엽니다.





1.2 Server Manager -> Manage -> Add Roles and Features









1.3 Server Manager -> Manage -> Add Roles and Features -> Features -> Network Load Balacing : Check



1.4 Server Manager -> Manage -> Add Roles and Features -> Server Roles-> Web Server (IIS) : Check




1.5 Network Load Balancing Manager 를 엽니다.





2. AppTest 별 설정



2.1 AppTest1 을 여기까지





2.2 AppTest2 를 여기까지







2.3 AppTest1 의 IP설정을 한번 확인해봅니다


NAT 인터페이스는 자동으로 설정하여 10.0.2.15 를 부여 받았고


호스트 전용 어댑터는 # 1 에서 설정한대로 

IP 주소 : 192.168.20.11

서브넷마스크 : 255.255.255.0

게이트웨이 : 192.168.20.1

기본 설정 DNS 서버 : 192.168.20.1

로 설정합니다.


http://tansanc.tistory.com/entry/Windows-Network-Load-Balancing-VirtualBox-Windows2012-1








2.4 AppTest2 의 IP설정을 한번 확인해봅니다


NAT 인터페이스는 자동으로 설정하여 10.0.2.15 를 부여 받았고


호스트 전용 어댑터는 # 1 에서 설정한대로 

IP 주소 : 192.168.20.12

서브넷마스크 : 255.255.255.0

게이트웨이 : 192.168.20.1

기본 설정 DNS 서버 : 192.168.20.1

로 설정합니다.





Redis Client Connect Test

Programming/Redis 2016. 10. 26. 11:52 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Redis Client Connect Test





CLIENT LIST

The CLIENT LIST command returns information and statistics about the client connections server in a mostly human readable format.

Return value

Bulk string reply: a unique string, formatted as follows:

  • One client connection per line (separated by LF)
  • Each line is composed of a succession of property=value fields separated by a space character.

Here is the meaning of the fields:

  • id: an unique 64-bit client ID (introduced in Redis 2.8.12).
  • addr: address/port of the client
  • fd: file descriptor corresponding to the socket
  • age: total duration of the connection in seconds
  • idle: idle time of the connection in seconds
  • flags: client flags (see below)
  • db: current database ID
  • sub: number of channel subscriptions
  • psub: number of pattern matching subscriptions
  • multi: number of commands in a MULTI/EXEC context
  • qbuf: query buffer length (0 means no query pending)
  • qbuf-free: free space of the query buffer (0 means the buffer is full)
  • obl: output buffer length
  • oll: output list length (replies are queued in this list when the buffer is full)
  • omem: output buffer memory usage
  • events: file descriptor events (see below)
  • cmd: last command played

The client flags can be a combination of:

O: the client is a slave in MONITOR mode
S: the client is a normal slave server
M: the client is a master
x: the client is in a MULTI/EXEC context
b: the client is waiting in a blocking operation
i: the client is waiting for a VM I/O (deprecated)
d: a watched keys has been modified - EXEC will fail
c: connection to be closed after writing entire reply
u: the client is unblocked
U: the client is connected via a Unix domain socket
r: the client is in readonly mode against a cluster node
A: connection to be closed ASAP
N: no specific flag set

The file descriptor events can be:

r: the client socket is readable (event loop)
w: the client socket is writable (event loop)


'Programming > Redis' 카테고리의 다른 글

Hiredis SMEMBERS 활용  (0) 2017.01.24
Hiredis Subscribe/Publish with CWinThread  (0) 2016.10.05
How to use Pub/sub with hiredis in C++?  (0) 2016.09.29
hiredis fatal error C1853:  (0) 2016.09.29
hiredis MFC import Visual Studio 2013  (0) 2016.09.28

hiredis MFC import Visual Studio 2013

Programming/Redis 2016. 9. 28. 11:49 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

hiredis MFC import




Hiredis is a minimalistic C client library for the Redis database.

It is minimalistic because it just adds minimal support for the protocol, but at the same time it uses a high level printf-alike API in order to make it much higher level than otherwise suggested by its minimal code base and the lack of explicit bindings for every Redis command.


1. Download Hiredis

Project Site : https://github.com/redis/hiredis


[Clone or download] [Download ZIP]




2. Include Hiredis Header Files



3. Config Hiredis Header Files Path







4. Build Hiredis Library File


Open Hiredis Project





Build Hiredis Project





5. Config Hiredis Library File Path





6. Sample Code




#include 
#include 
#include 

#include "hiredis.h"

#ifdef HIREDIS_WIN
#define snprintf sprintf_s
#endif

int main(void) {
    unsigned int j;
    redisContext *c;
    redisReply *reply;

    struct timeval timeout = { 1, 500000 }; // 1.5 seconds
    c = redisConnectWithTimeout((char*)"127.0.0.1", 6379, timeout);
    if (c->err) {
        printf("Connection error: %s\n", c->errstr);
        exit(1);
    }

    /* PING server */
    reply = redisCommand(c,"PING");
    printf("PING: %s\n", reply->str);
    freeReplyObject(reply);

    /* Set a key */
    reply = redisCommand(c,"SET %s %s", "foo", "hello world");
    printf("SET: %s\n", reply->str);
    freeReplyObject(reply);

    /* Set a key using binary safe API */
    reply = redisCommand(c,"SET %b %b", "bar", 3, "hello", 5);
    printf("SET (binary API): %s\n", reply->str);
    freeReplyObject(reply);

    /* Try a GET and two INCR */
    reply = redisCommand(c,"GET foo");
    printf("GET foo: %s\n", reply->str);
    freeReplyObject(reply);

    reply = redisCommand(c,"INCR counter");
    printf("INCR counter: %lld\n", reply->integer);
    freeReplyObject(reply);
    /* again ... */
    reply = redisCommand(c,"INCR counter");
    printf("INCR counter: %lld\n", reply->integer);
    freeReplyObject(reply);

    /* Create a list of numbers, from 0 to 9 */
    reply = redisCommand(c,"DEL mylist");
    freeReplyObject(reply);
    for (j = 0; j < 10; j++) {
        char buf[64];

        snprintf(buf,64,"%d",j);
        reply = redisCommand(c,"LPUSH mylist element-%s", buf);
        freeReplyObject(reply);
    }

    /* Let's check what we have inside the list */
    reply = redisCommand(c,"LRANGE mylist 0 -1");
    if (reply->type == REDIS_REPLY_ARRAY) {
        for (j = 0; j < reply->elements; j++) {
            printf("%u) %s\n", j, reply->element[j]->str);
        }
    }
    freeReplyObject(reply);

    return 0;
}


7. Sample Monitor






'Programming > Redis' 카테고리의 다른 글

Redis Client Connect Test  (0) 2016.10.26
Hiredis Subscribe/Publish with CWinThread  (0) 2016.10.05
How to use Pub/sub with hiredis in C++?  (0) 2016.09.29
hiredis fatal error C1853:  (0) 2016.09.29
Windows7 Redis 설치 및 실행  (0) 2016.09.27

Windows7 Redis 설치 및 실행

Programming/Redis 2016. 9. 27. 14:21 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Redis


Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as stringshasheslistssets,sorted sets with range queries, bitmapshyperloglogs and geospatial indexes with radius queries. Redis has built-in replicationLua scriptingLRU evictiontransactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.



1. Windows 용 redis


https://github.com/dmajkic/redis/downloads





2. execute redis-server.exe



3. execute redis-cli.exe




'Programming > Redis' 카테고리의 다른 글

Redis Client Connect Test  (0) 2016.10.26
Hiredis Subscribe/Publish with CWinThread  (0) 2016.10.05
How to use Pub/sub with hiredis in C++?  (0) 2016.09.29
hiredis fatal error C1853:  (0) 2016.09.29
hiredis MFC import Visual Studio 2013  (0) 2016.09.28
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

log4cxx MFC Client 와 log4j Java Server 연결



MFC Client 는 로그를 파일과 서버로 보내고,


Java Server 는 여러개의 MFC Client 가 보내는 로그를 저장한다.




테스트 환경은


MFC Client 와 Java Server 가 동일 호스트 이다.




MFC Client


log4j.rootLogger=DEBUG, filelog, remoteserver


rootLogger 에 필요한 로그 Appender 를 추가한다.


remoteserver라는 Appender 를 설정한다.


SocketAppender 를 사용하고, localhost:4445 에 연결한다.


# using remoteserver appender

log4j.appender.remoteserver=org.apache.log4j.net.SocketAppender

log4j.appender.remoteserver.remoteHost=localhost

log4j.appender.remoteserver.port=4445

log4j.appender.remoteserver.locationInfo=true

log4j.appender.remoteserver.ReconnectionDelay=10000






Java Server



테스트에서는 


log4j-1.2.17 버전을 사용하였다.


log4j-1.2.17.zip



압축을 푼 후 jar 파일을 Library 로 add 한다.





서버의 설정은 log4j-server.properties


RollingFileAppender 를 사용하여


파일 단위로 Log 를 저장한다.




log4j.rootLogger=DEBUG, file

log4j.appender.file=org.apache.log4j.RollingFileAppender

log4j.appender.file.File=logfile.log

log4j.appender.file.MaxFileSize=1MB

log4j.appender.file.MaxBackupIndex=1

log4j.appender.file.layout=org.apache.log4j.PatternLayout

log4j.appender.file.layout.ConversionPattern=[%d] [%t] [%m]%n





Java Server Code



public class Test

{

public static void main(String[] args) {

        try  

        {  

       

        String[] arguments = {"4445", "log4j-server.properties"};  

        SimpleSocketServer.main(arguments);  


        }  

        catch (Exception ex)  

        {  

          System.out.println(ex.getMessage());

        }  

}

}





Java Server/Client Code

Programming/JAVA,JSP 2015. 11. 12. 13:23 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
Client.java
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;


class MyFrame extends JFrame {
	public static JTextArea textArea;
	JTextField textField;
	PrintWriter out;
	
	public MyFrame() {
		textArea = new JTextArea();
		textField = new JTextField();
		add(BorderLayout.CENTER, textArea);
		add(BorderLayout.SOUTH, textField);
		textField.addActionListener(new FieldListener());
		setSize(300,200);
		setTitle("채팅프로그램 Client");
		setVisible(true);
		// GUI를 설계한다.
	}
	class FieldListener implements ActionListener
	{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			out.println(textField.getText());
			textField.setText("");
			// 메세지 보내기
		}		
	}
}

class SendThread extends Thread {
	PrintWriter out;
	public SendThread(PrintWriter out)
	{
		this.out = out;
	}
	@Override
	public void run() {
		// TODO Auto-generated method stub
		super.run();
	}
}

class RecvThread extends Thread {
	BufferedReader in;
	public RecvThread(BufferedReader in)
	{
		this.in = in;
	}
	@Override
	public void run() {
		String temp;
		try {
			while ((temp = in.readLine()) != null) {
				
				MyFrame.textArea.setText(
						MyFrame.textArea.getText()
						+ "\n" + temp);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

class ClientModule {
	MyFrame mFrame;
	SendThread mSendThread;
	RecvThread mRecvThread;
	Socket s;

	// 서버에 패킷을 보내는 Thread
	// 서버로부터 패킷을 받는 Thread
	public ClientModule() // 준비
	{

		try {
			s = new Socket("192.168.10.151", 33333);
			PrintWriter out = new PrintWriter(s.getOutputStream(), true);
			BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
			mFrame = new MyFrame(); // GUI 객체
			mFrame.out = out;
			mSendThread = new SendThread(out);
			mRecvThread = new RecvThread(in);			
		}  catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	void start() // 시작
	{
		mSendThread.start();
		mRecvThread.start();
	}
}

public class Client {
	public static void main(String[] args) {
		ClientModule cm = new ClientModule();
		// 초기화 작업
		cm.start();
		// Thread.start();
	}
}

Server.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

class PerClientThread extends Thread {
	Socket s;
	static ArrayList socketArray = new  ArrayList();

	@Override
	public void run() {
		// TODO Auto-generated method stub

		socketArray.add(s);
		
		BufferedReader br;
		try {
			br = new BufferedReader(new InputStreamReader(s.getInputStream()));
			String temp;
			while ((temp = br.readLine()) != null) {
				System.out.print(s.getInetAddress() + " : ");
				System.out.println(temp);
				for( int i = 0 ; i < socketArray.size() ; i++)
				{
					PrintWriter os = 
							new PrintWriter
							(socketArray.get(i).getOutputStream()
									,true);
					os.print(s.getInetAddress() + " : ");
					os.println(temp);
				}
			}

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		super.run();
	}
}

public class Test {
	public static void main(String[] args) throws Exception {

		System.out.println("Server Side");
		ServerSocket ss = new ServerSocket(33333);
		Socket s;
		while (true) {
			s = ss.accept();
			PerClientThread pct = new PerClientThread();
			pct.s = s;
			pct.start();
		}

	}
}

'Programming > JAVA,JSP' 카테고리의 다른 글

Java CardLayout Test  (0) 2016.01.26
정올 알고리즘 2247 도서관 문제  (0) 2015.11.26
[Spring] 한글 인코딩 설정  (0) 2015.10.29
mysql table datetime tip  (0) 2014.10.20
JSP, MYSQL, ECLIPSE 연동하기  (0) 2014.10.12

Java Chatting Server, Client

Programming/JAVA,JSP 2014. 7. 12. 16:18 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

 

 

 

 

JavaChattingClient.zip

 

JavaChattingServer.zip

 

'Programming > JAVA,JSP' 카테고리의 다른 글

mysql table datetime tip  (0) 2014.10.20
JSP, MYSQL, ECLIPSE 연동하기  (0) 2014.10.12
JScrollPane , ScrollPane 차이점  (0) 2014.07.12
Java ScrollPane 활용  (0) 2014.07.12
java  (0) 2014.07.12

CISCO packet tracer VPN client 설정

CiscoNetwork 2013. 12. 2. 17:16 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

aaa new-model

aaa authentication login GROUPNAME local

aaa authorization network GROUPNAME local

username USERNAME password 0 PASSWORD


crypto isakmp policy 1

 encr 3des

 authentication pre-share

 group 2


crypto isakmp client configuration group GROUPNAME

key KEYVALUE

pool IPPOOL


crypto ipsec transform-set TRANSFORMSETNAME esp-3des esp-md5-hmac


crypto dynamic-map DYNAMICMAPNAME 10

set transform-set TRANSFORMSETNAME

reverse-route


crypto map CLIENTMAP client authentication list GROUPNAME

crypto map CLIENTMAP isakmp authorization list GROUPNAME

crypto map CLIENTMAP client configuration address respond

crypto map CLIENTMAP 10 ipsec-isakmp dynamic DYNAMICMAPNAME


원하는 인터페이스

crypto map CLIENTMAP


ip local pool IPPOOL 172.16.12.100 172.16.12.120



클라이언트 접속시

GROUPNAME

KEYVALUE

router ip

USERNAME

PASSWORKD



'CiscoNetwork' 카테고리의 다른 글

Domain, WorkGroup ?  (0) 2016.03.07
ipTIME 공유기 포트 미러링 지원 제품 및 설정방법  (0) 2015.09.16
UTP5 cables PPT  (0) 2013.04.29
시스코 라우터 디폴트 값 확인 사이트  (0) 2013.01.25
실습장비 관련 정보  (0) 2013.01.25