Linux ¾ªÈºÏÖÏó
ÔÚlinuxÖУ¬¾ªÈºÏÖÏóÒѾÏûʧÁ˵ģ¬ÎÒÃÇ¿ÉÒÔ¿´ http://simohayha.javaeye.com/blog/561424 £¬µ«Êǵ±ÎÒÃÇÔÚ¿ª·¢·þÎñÆ÷ʱºò£¬ÐèҪʹÓÃepoll£¬·¢ÏÖÒ»¸öÎÊÌ⣬¾ÍÊǵ±Ò»¸öÇëÇó¹ýÀ´µÄʱºò£¬·¢ÏÖÓеÄʱºò±»»½ÆðµÄ½ø³Ì²»Ö¹Ò»¸ö£¬¿´ÏÂÃæµÄ³ÌÐò:#include <sys/socket.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include <errno.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#define KEY 1234
#define SIZE 1024
#define PORT 9999
#define MAXFDS 5000
#define EVENTSIZE 100
void process();
int fd, cfd,opt=1;
int shmid;
char *shmaddr;
struct shmid_ds buf;
int num = 0 ;
int main(int argc, char *argv[])
{
shmid = shmget(KEY,SIZE,IPC_CREAT|0600); /* ½¨Á¢¹²ÏíÄÚ´æ */
if(shmid == -1){
printf("create share memory failed\n");
}
shmaddr = (char *)shmat(shmid,NULL,0);
if(shmaddr == (void *)-1){
printf("connect to the share memory failed: %s",strerror(errno));
return 0;
}
strcpy(shmaddr,"1\n");
struct sockaddr_in sin, cin;
socklen_t sin_len = sizeof(struct sockaddr_in);
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) <= 0)
{
fprintf(stderr, "socket failed\n");
return -1;
}
memset(&sin, 0, sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = htons((short)(PORT));
sin.sin_addr.s_addr = INADDR_ANY;
if (bind(fd, (struct sockaddr *)&sin, sizeof(sin)) != 0)
{
fprintf(stderr, "bind failed\n");
return -1;
}
if (listen(fd, 32) != 0)
{
fprintf(stderr, "listen failed\n");
return -1;
}
int i ;
for(i = 0; i < 2; i++)
{
int pid = fork();
if(pid == 0)
{
Ïà¹ØÎĵµ£º
Linuxϵ¥»úÅäÖÃNutch
1.»·¾³½éÉÜ
²Ù×÷ϵͳ£ºRed hat linux 9
Nutch°æ±¾£ºnutch-0.9,ÏÂÔØ£ºhttp://apache.etoak.com/lucene/nutch/
JDK°æ±¾£ºJDK 1.6
Apache Tomcat°æ±¾£ºapache-tomcat-6.0.18
http://apache.etoak.com/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
2.ÅäÖÃǰÌá
2.1 °²×°jdk ......
Õâ¶Îʱ¼äѧϰ×Ö·ûÉ豸µÄÇý¶¯Ä£¿é³ÌÐò£¬Ö÷ÒªÊÇ½è¼øÊé¼®<linuxÇý¶¯¿ª·¢Ïê½â>¼°ÍøÂç×ÊÔ´£¬ÔÚ´Ë£¬ÎÒÒÀ¾Ý¸öÈ˵ÄÀí½â£¬
¶ÔÏÖÔÚ×Ô¼ºËùÀí½âµÄ½øÐÐС½á¡£
ÕûÌå³ö·¢Ò»µã£¬Ó¦ÓóÌÐòºÍvfsÖ®¼äµÄ½Ó¿ÚÊÇϵͳµ÷Ó㬶øVFSÓë´ÅÅÌÎļþϵͳ¼°ÆÕͨÉ豸֮¼äµÄ½Ó¿ÚÊÇfile_operations
½á¹¹Ìå³ÉÔ±º¯Êý£¬Õâ¸ö½Ó¿ÚÌå°üº¬¶ÔÎļþ½øÐдò¿ª¡¢¹Ø±Õ ......
½øÈëlinuxºó·¢ÏÖ£¬°²×°ÏµÍ³Ê±Ã»°²×°ÖÐÎÄ×ÖÌ壬ÏÔʾ¶¼ÊÇÂÒÂë¡£
¡¡¡¡Ã»°ì·¨£¬µ½ÍøÉÏËÑËѰɡ£ÕÒµ½¸ö½â¾ö·½·¨¡£
¡¡¡¡´ó¼ÒƽʱʹÓÃϰ¹ßÁ˵ÄwinxpÀïÃæµÄËÎÌå¡¢»¹Óз½ÕýÅŰæÏµÍ³ÀïÃæµÄ·ÂËÎÌå¡¢¹«ÎÄÖеķ½ÕýС±êËεȵȣ¬ÕâЩ×ÖÌå¶¼ÊÇÉÌÒµ¹«Ë¾¿ª·¢³öÀ´ÓÃÔÚ×Ô¼ºµÄ²úÆ·Öеģ¬ÊÇÓаæÈ¨µÄ£¬ËùÒÔlinux²»ÄÜÄùýÀ´¾ÍÓá£Èç¹ûÄ㻹ûÓÐÌý˵¹ ......
ѧlinuxÒ²ÓÐÒ»¶Îʱ¼äÁË£¬´ÓÒ»¸ö²ËÄñ³É³¤ÎªõçõÇ×ß·µÄ³ûÄñ£¬Ò»Â·×ßÀ´£¬ÄÑÃâÓÐЩ¿Ä¿ÄÅöÅö¡£¶ÔlinuxµÄÈÏʶҲ´ÓÌý˵ºÜÇ¿´ó£¬µ½Ç××ÔÌåÑéËüµÄ¿ªÔ´¡¢°²
È«¡¢ÒÔ¼°ÓÅÔ½µÄÐÔÄÜ£¬²»¹ýÒ²³Ô¾¡ÁË¿àÍ·£¬ÕæµÄÊÇÎåζ¾ãÈ«¡£
¶¼Ëµlinux¹¦ÄÜÇ¿´ó£¬×Ô´ÓÎÒ½Ó´¥ÁËlinux¾Í¸Ð¾õµ½ÁËËüµÄÇ¿´ó¡£Ç¿´óµÄ°²È«ÐÔÄÜ£¬ ......