summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlishu <[email protected]>2018-09-30 11:12:01 +0800
committerlishu <[email protected]>2018-09-30 11:12:01 +0800
commit00ab3d6d0a00d310e0964f9d2237c6a2d68b825e (patch)
tree54b593a8ef57229838a889db30e6f4e87310ef07
parent4ac33d9d46da16f249523cdb930d0831dd1b57b1 (diff)
20180930 更新tango_cache
-rw-r--r--bin/conf/main.conf41
-rw-r--r--src/Makefile4
-rw-r--r--src/digest_detection.c4
-rw-r--r--src/lib/pangu_tango_cache.abin229256 -> 236060 bytes
-rw-r--r--src/log.c4
-rw-r--r--src/main.c22
-rw-r--r--src/recv.c2
7 files changed, 36 insertions, 41 deletions
diff --git a/bin/conf/main.conf b/bin/conf/main.conf
index 4b5bb2c..c86181a 100644
--- a/bin/conf/main.conf
+++ b/bin/conf/main.conf
@@ -18,7 +18,7 @@ FullCfgDir=/home/mesasoft/dd/ddrule/full/index/
IncCfgDir=/home/mesasoft/dd/ddrule/inc/index/
[LOG]
-LogLevel=1
+LogLevel=10
LogPath=./log/runtime.log
#resp msg log
@@ -38,37 +38,28 @@ SysinfoCycle=2
SysinfoFile=./log/dd_sysinfo.log
[TANGO_CACHE]
-#MINIO IP��ַ��Ŀǰֻ֧��һ��
-
-MINIO_BROKERS_LIST=192.168.10.64:9000
-
-
-
-#ÿ��������࿪����������
+#MINIO IP地址,目前只支持一个
+MINIO_IP_LIST=192.168.10.61-64;
+MINIO_LISTEN_PORT=9000
+#每个域名最多开启的链接数
MAX_CONNECTION_PER_HOST=10
-
-
-#bucket������
-
+#bucket的名称
CACHE_BUCKET_NAME=openbucket
-
-
-#�������ռ�õ��ڴ�ռ��С�������ռ�ʱ�ϴ�ʧ��
-
+#缓存最大占用的内存空间大小,超出空间时上传失败
MAX_USED_MEMORY_SIZE_MB=5120
+#上传时Expires头部的过期时间,单位秒,最小60(1分钟)
+CACHE_DEFAULT_TTL_SECOND=3600
-
-#�ϴ�ʱExpiresͷ���Ĺ���ʱ�䣬��λ�룬��С60��1���ӣ�
-
-CACHE_DEFAULT_TTL_SECOND=60
-
-
-
-#�Ƿ�Զ�������ƽ��й�ϣ��������ϣ����������ϴ����ص�����
-
+#是否对对象的名称进行哈希,开启哈希有助于提高上传下载的速率
CACHE_OBJECT_KEY_HASH_SWITCH=0
+#WIRED LOAD BALANCER配置
+#WIREDLB_OVERRIDE=1
+#WIREDLB_TOPIC=
+#WIREDLB_GROUP=
+#WIREDLB_DATACENTER=
+
diff --git a/src/Makefile b/src/Makefile
index 0041557..09040ff 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -17,8 +17,8 @@ CC = g++
CCC = g++
LIB = -L./lib/
-LIB += -lssl -lcrypto -lxml2 -lcurl -levent
-LIB += -lMESA_handle_logger -lMESA_prof_load -lmaatframe -lrulescan -lMESA_htable -lMESA_field_stat2 -lpthread
+LIB += -lssl -lcrypto -lxml2 -lcurl -levent -lpthread
+LIB += -lMESA_handle_logger -lMESA_prof_load -lmaatframe -lrulescan -lMESA_htable -lMESA_field_stat2 -lWiredLB
LIB += ./lib/libmy_socket.a
LIB += ./lib/pangu_tango_cache.a
#LIB += ./lib/libdictator_debug.a
diff --git a/src/digest_detection.c b/src/digest_detection.c
index 6590cb7..741de94 100644
--- a/src/digest_detection.c
+++ b/src/digest_detection.c
@@ -43,7 +43,7 @@ void renew_media(media_t* mdi)
{
if(NULL!=mdi)
{
- create_media_write_to_log(mdi, MEDIA_RENEW, NULL);
+ create_media_write_to_log(mdi, MEDIA_RENEW, NULL);
mdi->hit_digest = 0;
}
}
@@ -161,7 +161,7 @@ void send_survey(frag_in_t* frg, media_t* mdi, struct Maat_rule_t* scan_result)
memset(&meta, 0, sizeof(struct tango_cache_meta));
meta.url = key;
- pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
+ pdata = (struct future_pdata *)calloc(1, sizeof(struct future_pdata));
pdata->future = future_create(put_future_success, put_future_failed, pdata);
promise_set_ctx(future_to_promise(pdata->future), NULL, NULL);
cache_evbase_upload_once_data(g_dd_run.instance_asyn[mdi->thread_seq], pdata->future, PUT_MEM_COPY, frg->data, frg->datalen, &meta, out_fullfilename, sizeof(out_fullfilename));
diff --git a/src/lib/pangu_tango_cache.a b/src/lib/pangu_tango_cache.a
index ebca89a..0094000 100644
--- a/src/lib/pangu_tango_cache.a
+++ b/src/lib/pangu_tango_cache.a
Binary files differ
diff --git a/src/log.c b/src/log.c
index 2700989..dc91d9e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -310,9 +310,9 @@ void resp_write_to_log(int type, msg_result_t* msi_survey, void* param1, void* p
{
case SEND_SURVEY:
buflen = snprintf(buf, sizeof(buf),
- "%s.%ld,%20s,MID:%" PRIu64 ",service:%d,cfgid:%u,recv_byte:%" PRIu64 ",media_len:%" PRIu64 ",DataURL:%s\n",
+ "%s.%ld,%20s,MID:%" PRIu64 ",service:%d,cfgid:%u,recv_byte:%" PRIu64 ",media_len:%" PRIu64 ",thread_id:%d,DataURL:%s\n",
now_time, tv.tv_usec,"send_survey",
- *(uint64_t*)msi_survey->pid, msi_survey->servicetype, msi_survey->cfgid, mdi->byte_in,mdi->media_len,(char*)param1);
+ *(uint64_t*)msi_survey->pid, msi_survey->servicetype, msi_survey->cfgid, mdi->byte_in,mdi->media_len,mdi->thread_seq,(char*)param1);
break;
diff --git a/src/main.c b/src/main.c
index 1dfab42..40f01de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,12 +22,13 @@
#include "my_socket.h"
#include "cache_evbase_client.h"
-int DD_VERSION_1_0_20180927 = 0;
+int DD_VERSION_1_0_20180930 = 0;
const char* dd_version_des = "MESA@iie digest";
void digest_detection_history()
{
//2018.09.27 v1.0 create the project
+ //2018.09.30 v1.0 update cache
}
dd_parameter_t g_dd_run;
@@ -252,11 +253,11 @@ int main(int argc, char **argv)
{
return -1;
}
-
+
for(uint32_t i=0;i<g_dd_cfg.thread_num;i++)
{
g_dd_run.instance_asyn[i] = cache_evbase_instance_new("./conf/main.conf", "TANGO_CACHE", g_dd_run.logger);
- }
+ }
/*stat thread*/
if(0<g_dd_stat.stat_interval)
@@ -288,12 +289,15 @@ int main(int argc, char **argv)
return -1;
}
- if(-1 == create_pthread(recv_data_from_queue,NULL, g_dd_run.logger))
- {
- MESA_handle_runtime_log(g_dd_run.logger, RLOG_LV_FATAL, DD_MODULE_NAME,
- (char*)"[%s:%d] recv_data_from_queue Create Failed." , __FILE__,__LINE__);
- return -1;
- }
+ for(uint32_t i=0;i<g_dd_cfg.thread_num;i++)
+ {
+ if(-1 == create_pthread(recv_data_from_queue,(void*)i, g_dd_run.logger))
+ {
+ MESA_handle_runtime_log(g_dd_run.logger, RLOG_LV_FATAL, DD_MODULE_NAME,
+ (char*)"[%s:%d] recv_data_from_queue Create Failed." , __FILE__,__LINE__);
+ return -1;
+ }
+ }
while(1)
{
diff --git a/src/recv.c b/src/recv.c
index 8a171c4..953eed3 100644
--- a/src/recv.c
+++ b/src/recv.c
@@ -71,7 +71,7 @@ void proc_data(uint32_t thread_id, uint32_t src_ip, char* packet, int size)
inet_ntop(AF_INET, &src_ip, pbuf, buf_len);
{
MESA_handle_runtime_log(g_dd_run.logger, RLOG_LV_DEBUG, DD_MODULE_NAME,
- "{%s:%d} %s:%u RECV DATA [PID:%llu, offset:%llu, datalen:%u]",
+ "{%s:%d} %s:%hd RECV DATA [PID:%llu, offset:%llu, datalen:%u]",
__FILE__,__LINE__, pbuf, g_dd_cfg.recv_port, *(uint64_t*)mdata->pid, mdata->offset, mhead->c_len-sizeof(av_data_t));
}
}