GVKun编程网logo

在win7(64)上用vs2013(64)编译zlib出错

7

在本文中,您将会了解到关于在win7的新资讯,同时我们还将为您解释64上用vs2013的相关在本文中,我们将带你探索在win7的奥秘,分析64上用vs2013的特点,并给出一些关于C++CreateP

在本文中,您将会了解到关于在win7的新资讯,同时我们还将为您解释64上用vs2013的相关在本文中,我们将带你探索在win7的奥秘,分析64上用vs2013的特点,并给出一些关于C ++ CreateProcess在Windows 7上从套接字接收path失败(64)、CentOS 6.3(64) ---> fastdfs_v4.07 / 实现多服务器、CentOS7(64)环境使用 rpm 命令安装 gcc、Cocos2D-x 入门(2) win7(64)+VS2013+cocos2d-x 3.6环境配置的实用技巧。

本文目录一览:

在win7(64)上用vs2013(64)编译zlib出错

在win7(64)上用vs2013(64)编译zlib出错

在caffe安装中,试图在win7(64)上通过vs2013(64)编译(构build解决scheme) zlib1.2.8得到如下图所示的错误。

默认的解决scheme是打开的

...Desktopzlibcontribvstudiovc11zlibvc.sln

错误消息

错误MSB3073:用代码9009退出命令“cd …. contrib masmx64 bld_ml64.bat:VCEnd”。C: Program Files(x86) MSBuild Microsoft.Cpp v4.0 V120 Microsoft.CppCommon .targets 122 5 zlibvc

Windows批处理:在后台运行一个进程并等待它

有没有办法解决这个推送错误?

如何使用需要特定文件名的CLI工具在批处理脚本中使用通配符?

使用名称批处理脚本中的空格移动文件

如何添加一个registry项与默认值包含双引号和percentcent标志?

但在命令行运行bld_ml64.bat没有错误。

任何build议,谢谢。

batch file来search和replace一个string

如果for循环具有空variables,则Windows批处理会发生错误

删除以XXX开头的registry

Windows 8 cli采取截图

获取Windowsbatch file参数的名称,而不是位置

在Windows 10上,使用VS2013(目标是x64)的zlib 1.2.8也有同样的问题。

我能够通过zlibvc.vcxproj解决它:

在ItemDeFinitionGroup Condition =“'$(Configuration)| $(Platform)'=='Debug | x64'”

更改:

<PreBuildEvent> <Command>cd ......contribmasmx64 bld_ml64.bat </Command> </PreBuildEvent>

您也可以手动将命令清空并bld_mlbat64.bat。

C ++ CreateProcess在Windows 7上从套接字接收path失败(64)

C ++ CreateProcess在Windows 7上从套接字接收path失败(64)

我正在尝试使用CreateProcess()函数来创build一个简单的应用程序控制器。 该程序接收程序的path,将由套接字执行并将其存储到char []variables中,稍后将该variables发送给执行该variables的函数。

我得到的错误是

Client: Received data is: C:WindowsSystem32calc.exe Server: Bytes received: 30. CreateProcess Failed (123).

(2)= ERROR_FILE_NOT_FOUND

我尝试了doble斜线(/),我收到错误(123)

如何使用本地networking系统控制Pd Vanilla> 0.46的VLC?

如何唤醒睡在recvmsg()中的pthread?

ENOBUFS在使用socket.io创build到多个套接字时

C ++类似ping的function,无需超级用户访问

Nginx无法find与Unicorn的unix套接字文件(没有这样的文件或目录)

Client: Received data is: C:\Windows\System32\calc.exe Server: Bytes received: 33. CreateProcess Failed (123).

(123)= ERROR_INVALID_NAME

接收程序执行path的函数:

bytesRecv = recv(m_socket,recvbuf,200,0); if (bytesRecv == SOCKET_ERROR) printf("Server: recv() error %ld.n",WSAGetLastError()); else { printf("nClient: Received data is: %sn",recvbuf); printf("Server: Bytes received: %ld.n",bytesRecv ); NewProcess(1,LPWSTR(recvbuf)); // <---- Call to NewProcess function with path }

以及启动过程的function:

void NewProcess(int count,LPWSTR cmd) { LPTSTR concatenation = _T(" "); LPTSTR cmdArgs = NULL; STARTUPINFO si; PROCESS_informatION pi; ZeroMemory( &si,sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi,sizeof(pi) ); si.wShowWindow = SW_HIDE; si.dwFlags = STARTF_USESHOWWINDOW; // Start the child process. if( !CreateProcess( NULL,// Program full path cmd,// Arguments NULL,// Process handle not inheritable NULL,// Thread handle not inheritable FALSE,// Set handle inheritance to FALSE 0,// No creation flags NULL,// Use parent's environment block NULL,// Use parent's starting directory &si,// Pointer to STARTUPINFO structure &pi ) // Pointer to PROCESS_informatION structure ) { printf( "CreateProcess Failed (%d).n",GetLastError() ); return; } // Wait until child process exits. WaitForSingleObject( pi.hProcess,INFINITE ); printf("nProcess ID: %d Terminated!",pi.dwProcessId); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }

你能告诉我什么是错的,我supose是关于variablestypes,但我找不到错误。

提前致谢。

SocketServer.Tcpsocket工作在股票python,但不是与MSVCRT100编译与新的OpenSSL的python

套接字对,Perl,KEEPALIVE和轮询

linux原生socket编程问题

如何虚拟化Linux应用程序正在监听的IP端口?

何时调用setsockopt? bind()和connect()之前?

问题在这里:

LPWSTR(recvbuf)

您已经将缓冲区转换为宽字符数组的指针,但不是。 我们可以这样说,因为在你写信之前:

printf("nClient: Received data is: %sn",recvbuf);

这意味着recvbuf是一个指向8位ANSI字符数组的指针。 要么使用CreateProcessA ,要么从ANSI转换为UTF-16。

你应该从中吸取教训,那就是每当你投出一个角色阵列时,你很可能会搞错了。 编译器可能会反对你传递recvbuf因为它正确地确定recvbuf的格式是错误的。 通过强制转换,你只是简单地压制编译器并对其进行说明。 你的演员不会使recvbuf成为LPWSTR 。 它仍然是LPSTR ,但是你已经告诉编译器忽略这个错误。

您将需要确保recvbuf以空终止。 如果传输失败,并且recvbuf不是空终止的,那么你有一个缓冲区溢出条件。

最后,转义反斜杠是你在源代码中做的事情。

CentOS 6.3(64) ---> fastdfs_v4.07 / 实现多服务器

CentOS 6.3(64) ---> fastdfs_v4.07 / 实现多服务器

     
     自己闲着没事,在小黑上虚拟了 4 个 centos 64 的系统,用来安装分布式 fastdfs 、 nginx 负载均衡,过程一路艰辛,搞了一个通宵都没弄好,终于在第二天的傍晚终于弄好了,记录一下过程。
     有时候看书会犯糊涂,看完了都不知道将了啥,只有动手坐坐,啥玩意都明白差不多了。
     有时候太懒了,哎,这是病,得治。

  • FastDFS 安装
        FastDFS 是一个国产开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问 (文件上传、文件下载) 等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等.FastDFS 服务端有两个角色:跟踪器 (tracker) 和存储节点 (storage). 跟踪器主要做调度工作,在访问上起负载均衡的作用.

  • 下载地址
    http://sourceforge.net/projects/fastdfs/files/
    http://code.google.com/p/fastdfs/




    实现多服务器 fastdfs



  • 整体网络配置
    Tracker  Server    192.168.55.222         /home/tracker  端口:22122
    Tracker  Server    192.168.55.226         /home/tracker  端口:22122
    Storage1 Server    192.168.55.223  group1 /home/storage  端口:23000
    Storage4 Server    192.168.55.227  group1 /home/storage  端口:23000
    Storage2 Server    192.168.55.224  group2 /home/storage  端口:23000
    Storage3 Server    192.168.55.225  group2 /home/storage  端口:23000
    #Storage2为group2的源服务器
    注意:
    1.group2同组的Storage2和Storage3 FastDFS服务端口必须一致: port=23000。
    2.一台服务器可以装多个组(group)但不能装同组的多个Storage,日志会报错误,日志报错原因是"注意1"
    3.Version 4.05之前fastdfs内部绑定了libevent作为http服务器.Version 4.05之后的版本删除了内置的web http服务,内置的web http服务是个累赘,不用也罢!
    4.启动storage server时,一直处于僵死状态.启动storage server,storage将连接tracker server,如果连不上,将一直重试。直到连接成功,启动才算真正完成!如果集群中有2台tracker server,而其中一台tracker没有启动,可能会导致storage server一直处于僵死状态
  • 系统操作环境的设置
    #软件安装包存储:
      /usr/local/src
      /usr/local/fastdfs  fastdfs安装目录
    
    #基本目录列表:
    #创建fastdfs用户
      /usr/sbin/groupadd fastdfs
      /usr/sbin/useradd -g fastdfs fastdfs
    #创建存储数据目录
      mkdir -p /home/fastdfs/tracker;#创建tracker目录保存运行日志
      mkdir -p /home/fastdfs/storage;#创建Storage目录保存运行日志及其data数据 
    # source .bashrc
  • 为方便查找目录,设置变量
    ################Tracker################
    # vi .bashrc
      alias  worksrc=''cd /usr/local/src;ls''
      alias  workfastdfs=''cd /usr/local/fastdfs;ls''
      alias  worktracker=''cd /home/fastdfs/tracker;ls''
    #track启动 重启 停止
      alias  sertracker=''service fdfs_trackerd''
    配置生效
    # source .bashrc
  • 为方便查找目录,设置变量
    ################Storage################
    # vi .bashrc
      alias  worksrc=''cd /usr/local/src;ls''
      alias  workfastdfs=''cd /usr/local/fastdfs;ls''
      alias  workstorage=''cd /home/fastdfs/storage;ls''
      alias  workfastdfs=''cd /usr/local/nginx;ls''
    #storage启动 重启 停止
      alias  serstorage=''service fdfs_storaged''
    #nginx 启动 重启 停止
      alias  sernginx=''service nginxd''
    配置生效
    # source .bashrc

1. 安装 libevent 和 fastdfs

  • 首先安装 libevent. fastdfs 在编译源程序时 fastdfs 内部调用 libevent 的处理机制,,需要用到 libevent 一些依赖文件,否则编译 fastdfs 会出错
    #卸载系统自带libevent,自带版本过低,安装fastdfs会出错
      rpm -qa|grep libevent
    #  或者
      yum remove libevent*
    #下载安装libevent
    #worksrc;
      wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz;
      tar -zxvf libevent-2.0.19-stable.tar.gz;
      cd libevent-2.0.19-stable;
    #make clean;
      ./configure --prefix=/usr/local/libevent
      make && make install;
    #为libevent创建软链接到/lib库下,64位系统对应/lib64
      ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
      ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
    #命令汇总:
      worksrc;wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz;tar -zxvf libevent-2.0.19-stable.tar.gz;cd libevent-2.0.19-stable;make clean;./configure --prefix=/usr/local/libevent;make && make install;cd ../
  • 安装 fastdfs 的步骤
    worksrc;
    # 自行下载 4.07  http://sourceforge.net/projects/fastdfs/files/ 
    # wget http://fastdfs.googlecode.com/files/FastDFS_v4.06.tar.gz
      tar -zxvf FastDFS_v4.07.tar.gz
      cd FastDFS
    
    #由于定义/usr/local/fastdfs为fastdfs安装目录,所以需要修改make.sh
      vim make.sh
    #/etc/fdfs 全部替换为 /usr/local/fastdfs/conf
      %s/\/etc\/fdfs/\/usr\/local\/fastdfs\/conf/g
    
    # TARGET_PREFIX=/usr/local 修改为 /usr/local/fastdfs
      sed -i ''s:TARGET_PREFIX=.*:TARGET_PREFIX=/usr/local/fastdfs:g'' make.sh
    
    # TARGET_CONF_PATH=/etc/fdfs 修改为 /usr/local/fastdfs/conf
      sed -i ''s:TARGET_CONF_PATH=.*:TARGET_CONF_PATH=/usr/local/fastdfs/conf:g'' make.sh
    
    #安装
      ./make.sh C_INCLUDE_PATH=/usr/local/libevent/include LIBRARY_PATH=/usr/local/libevent/lib
      ./make.sh install
    修改 fastdfs 启动文件
    # 修改 fdfs_trackerd 配置文件
      vim /etc/init.d/fdfs_trackerd
    #替换
      %s/usr\/local/usr\/local\/fastdfs/g
      %s/etc\/fdfs/usr\/local\/fastdfs\/conf/g
    #增加x权限
      chmod a+x /etc/init.d/fdfs_trackerd
    
    # 修改 fdfs_storaged 配置文件
      vim /etc/init.d/fdfs_storaged
    #替换
      %s/usr\/local/usr\/local\/fastdfs/g
      %s/etc\/fdfs/usr\/local\/fastdfs\/conf/g
    #增加x权限
      chmod a+x /etc/init.d/fdfs_storaged


2. 安装 Tracker Server - 192.168.55.222

  • 引用上例中安装 libevent 和 fastdfs 步骤
  • 配置及启动 Tracker Server, 端口:22122
    #修改tracker.conf配置
      vim /usr/local/fastdfs/conf/tracker.conf
    # the tracker server port
      port=22122
    # the base path to store data and log files
      base_path=/home/yuqing/fastdfs -> base_path=/home/fastdfs/tracker #日志目录
    # sed -i ''s:base_path=.*:base_path=/home/fastdfs/tracker:g'' tracker.conf
      reserved_storage_space = 4GB -> reserved_storage_space = 1GB
    # sed -i ''s:reserved_storage_space=.*:reserved_storage_space = 1GB:g'' tracker.conf
    #unix group name to run this program,
    #not set (empty) means run by the group of current user
      run_by_group= -> fastdfs
    #unix username to run this program,
    #not set (empty) means run by current user
      run_by_user= -> fastdfs
    #开启自定义server ID取代ip形式,方便内部网络服务器更换ip#**此方式要重点理解,4.0以后新特性
      use_storage_id = true #使用server ID作为storage server标识
      storage_ids_filename = storage_ids.conf #<id> <group_name> <ip_or_hostname>
      id_type_in_filename = id #文件名反解析中包含server ID,以前是ip
    复制 storage_ids.conf 文件
    cp -r /usr/local/src/FastDFS/conf/storage_ids.conf /usr/local/fastdfs/conf/
    #编辑storage服务器ID与IP地址的对应关系
      vim /usr/local/fastdfs/conf/storage_ids.conf
    #<id> <group_name> <ip_or_hostname>
    # 100001          group1           192.168.55.223
  • 设置 Tracker Server 用户及组
    chown -R fastdfs:fastdfs /home/fastdfs
    增加 x 权限
    chmod a+x /etc/init.d/fdfs_trackerd
    启动 Tracker
    service fdfs_trackerd start
    #启动过程中出现的错误
      ./fdfs_trackerd: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
    #解决办法
      ln -s /usr/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
    #查看日志
      vim /home/fastdfs/tracker/logs/trackerd.log
    #启动后成功的日志
    #[2013-10-03 20:50:08] INFO - FastDFS v4.07, base_path=/home/fastdfs/tracker, run_by_group=fastdfs, run_by_user=fastdfs, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, accept_threads=1, work_threads=4, store#_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sy#nc_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_sp#ace_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, use_storage_id=1, id_type_in_filename=id, storage_id_count=1, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, store_slave_file_use_link=0, use_con#nection_pool=0, g_connection_pool_max_idle_time=3600s
    设置开机启动 Tracker
    vim /etc/rc.d/rc.local
      service fdfs_trackerd start
    附目录说明
    #  tracker server目录及文件结构:
    #  ${base_path}
    #    |__data
    #    |     |__storage_groups.dat:存储分组信息
    #    |     |__storage_servers.dat:存储服务器列表
    #    |__logs
    #          |__trackerd.log:tracker server日志文件


3. 安装 Storage Server -192.168.55.223

  • 引用上例中安装 libevent 和 fastdfs 步骤
  • 修改 storage.conf 配置
    vim /usr/local/fastdfs/conf/storage.conf
    # the name of the group this storage server belongs to
      group_name=group1
    # the name of the group this storage server belongs to
    # the storage server port #the storage server port
      port=23000
    # the base path to store data and log files #日志目录
      base_path=/home/yuqing/fastdfs -> /home/fastdfs/storage
    # store_path#, based 0, if store_path0 not exists, it''s value is base_path #data数据存储目录
    # the paths must be exist
      store_path0=/home/fastdfs/storage
    # tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
      tracker_server=192.168.209.121:22122 ->192.168.55.222:22122
    #unix group name to run this program,
    #not set (empty) means run by the group of current user
      run_by_group= -> fastdfs   #这儿一定填写执行的用户名,不然会启动报错,测试环境填写的 root
    #unix username to run this program,
    #not set (empty) means run by current user
      run_by_user= -> fastdfs   #这儿一定填写执行的用户名,不然会启动报错,测试环境填写的 root
    设置 Storage Server 用户及组
    chown -R fastdfs:fastdfs /home/fastdfs
    增加 x 权限
    chmod a+x /etc/init.d/fdfs_storaged
    启动 Storage
    service fdfs_storaged start
    #接下来会出现很多mkdir data path,这是系统在创建数据目录
    #data path: /home/fastdfs/storage/data, mkdir sub dir...
    #mkdir data path: 00 ...
    #mkdir data path: 01 ...
    #mkdir data path: 02 ...
    #mkdir data path: 03 ...
    #.......................
    #data path: /home/fastdfs/storage/data, mkdir sub dir done.
    设置开机启动 Storage 
    vim /etc/rc.d/rc.local
      service fdfs_storaged start
    附目录说明
    #  storage server目录及文件结构:
    #  ${base_path}
    #    |__data
    #    |     |__storage_stat.dat:本地存储信息
    #    |     |__sync
    #    |           |__ binlog.000
    #    |           |__ binlog.index
    #    |__logs
    #          |__storaged.log:storage server日志文件
  • 安装 fastdfs-nginx-module 模块
    #创建相关用户和目录创建www用户和组
      /usr/sbin/groupadd www
      /usr/sbin/useradd -g www www
    #创建nginx日志目录
      mkdir -p /home/www/logs
      chmod a+w /home/www/logs
      chown -R www:www /home/www/logs
    安装 nginx
    cd /usr/local/src
    #下载 nginx
    #wget http://nginx.org/download/nginx-1.5.4.tar.gz
      tar -zxvf nginx-1.5.4.tar.gz
      cd nginx-1.5.4/
      ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module
      make && make install
    #--with-http_stub_status_module 用来监控nginx的当前状态
    安装 fastdfs-nginx-module 插件
    #worksrc;
      cd /usr/local/src
    # wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.15.tar.gz
      tar -zxvf fastdfs-nginx-module_v1.15.tar.gz
    #修改插件配置文件
      vim /usr/local/src/fastdfs-nginx-module/src/config
    ngx_addon_name=ngx_http_fastdfs_module
    HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
    CORE_INCS="$CORE_INCS /usr/local/fastdfs/include/fastdfs /usr/local/fastdfs/include/fastcommon/"
    CORE_LIBS="$CORE_LIBS -L/usr/local/fastdfs/lib -lfastcommon -lfdfsclient"
    CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE=''256*1024'' -DFDFS_MOD_CONF_FILENAME=''\"/usr/local/fastdfs/conf/mod_fastdfs.conf\"''"
    #复制mod_fastdfs.conf到/usr/local/fastdfs/conf/目录下
      cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /usr/local/fastdfs/conf/
    上面编译时使用的动态链接库
    #启动nginx报错
    #./nginx: error while loading shared libraries: libfastcommon.so: cannot open shared object file: No such file or directory
    #解决办法 ---> 将/usr/local/fastdfs/lib 加入系统文件/etc/ld.so.conf中
      vim /etc/ld.so.conf
      /usr/local/fastdfs/lib
    #更新库文件缓存ld.so.cache
      /sbin/ldconfig -v
    编译 fastdfs-nginx-module 模块
    # 重新编译nginx  
      cd /usr/local/src/nginx-1.5.4
      ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
      make; make install
    修改 mod_fastdfs.conf 配置
    vim /usr/local/fastdfs/conf/mod_fastdfs.conf
    # the base path to store log files
      base_path=/tmp
    # if load FastDFS parameters from tracker server
    # since V1.12
    # default value is false
      load_fdfs_parameters_from_tracker=true
    # FastDFS tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
    # valid only when load_fdfs_parameters_from_tracker is true
      tracker_server=192.168.55.222:22122
    # the port of the local storage server
    # the default value is 23000
      storage_server_port=23000
    # the group name of the local storage server
      group_name=group1
    # if the url / uri including the group name
    # set to false when uri like /M00/00/00/xxx
    # set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
    # default value is false
      url_have_group_name = true
    # path(disk or mount point) count, default value is 1
    # must same as storage.conf
      store_path_count=1
    # store_path#, based 0, if store_path0 not exists, it''s value is base_path
    # the paths must be exist
    # must same as storage.conf
      store_path0=/home/fastdfs/storage
    # set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
    # empty for output to stderr (apache and nginx error_log file)
      log_filename=/home/www/logs/mod_fastdfs.log
    nginx 配置简洁版本
    #vim /usr/local/nginx/conf/nginx.conf
    user  www www;
    worker_processes  2;
    error_log  /home/www/logs/error.log  notice;
    pid        /home/www/logs/nginx.pid;
    
    worker_rlimit_nofile 5120;
    events {
        use epoll;
        worker_connections  5120;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        sendfile        on;
        tcp_nopush     on;
        keepalive_timeout  60;
        tcp_nodelay on;
    
        server {
            listen       80;
            server_name  localhost;
            location /group1/M00 {
                alias /home/fastdfs/storage/data;
                ngx_fastdfs_module;
            }
        }
    }
    
    #启动nginx
      /usr/local/nginx/sbin/nginx


4. 安装 Storage Server -192.168.55.224

  • 引用上例中安装 libevent 和 fastdfs 步骤
  • 修改 storage.conf 配置 
    vim /usr/local/fastdfs/conf/storage.conf
    # the name of the group this storage server belongs to
      group_name=group2
    # the name of the group this storage server belongs to
    # the storage server port #the storage server port
      port=23000
    # the base path to store data and log files #日志目录
      base_path=/home/yuqing/fastdfs -> /home/fastdfs/storage
    # store_path#, based 0, if store_path0 not exists, it''s value is base_path #data数据存储目录
    # the paths must be exist
      store_path0=/home/fastdfs/storage
    #unix group name to run this program,
    #not set (empty) means run by the group of current user
      run_by_group= -> fastdfs    #这儿一定填写执行的用户名,不然会启动报错,测试环境填写的 root
    #unix username to run this program,
    #not set (empty) means run by current user
      run_by_user= -> fastdfs   #这儿一定填写执行的用户名,不然会启动报错,测试环境填写的 root
    # tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
      tracker_server=192.168.xxx.xxxx:22122 -> tracker_server=192.168.55.222:22122
  • 引用上例中 "编辑启动脚本" 步骤
    #启动 Storage  
      service fdfs_storaged restart
    #接下来会出现很多mkdir data path,这是系统在创建数据目录
    #data path: /home/fastdfs/storage/data, mkdir sub dir...
    #mkdir data path: 00 ...
    #mkdir data path: 01 ...
    #mkdir data path: 02 ...
    #mkdir data path: 03 ...
    #.......................
    #data path: /home/fastdfs/storage/data, mkdir sub dir done.
  • 安装 fastdfs-nginx-module 插件
    #worksrc;
      cd /usr/local/src
    # wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.15.tar.gz
      tar -zxvf fastdfs-nginx-module_v1.15.tar.gz
    #修改插件配置文件
      vim /usr/local/src/fastdfs-nginx-module/src/config
    ngx_addon_name=ngx_http_fastdfs_module
    HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
    CORE_INCS="$CORE_INCS /usr/local/fastdfs/include/fastdfs /usr/local/fastdfs/include/fastcommon/"
    CORE_LIBS="$CORE_LIBS -L/usr/local/fastdfs/lib -lfastcommon -lfdfsclient"
    CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE=''256*1024'' -DFDFS_MOD_CONF_FILENAME=''\"/usr/local/fastdfs/conf/mod_fastdfs.conf\"''"
    #复制mod_fastdfs.conf到/usr/local/fastdfs/conf/目录下
      cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /usr/local/fastdfs/conf/
    上面编译时使用的动态链接库
    #将/usr/local/fastdfs/lib 加入系统文件/etc/ld.so.conf中
      vim /etc/ld.so.conf
      /usr/local/fastdfs/lib
    #更新库文件缓存ld.so.cache
      /sbin/ldconfig
    编译 fastdfs-nginx-module 模块
    # 重新编译nginx  
      cd /usr/local/src/nginx-1.5.4
      ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
      make; make install
    修改 mod_fastdfs.conf 配置
    vim /usr/local/fastdfs/conf/mod_fastdfs.conf
    # the base path to store log files
      base_path=/tmp
    # if load FastDFS parameters from tracker server
    # since V1.12
    # default value is false
      load_fdfs_parameters_from_tracker=true
    # FastDFS tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
    # valid only when load_fdfs_parameters_from_tracker is true
      tracker_server=192.168.25.11:22122
    # the port of the local storage server
    # the default value is 23000
      storage_server_port=23000
    # the group name of the local storage server
      group_name=group2
    # if the url / uri including the group name
    # set to false when uri like /M00/00/00/xxx
    # set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
    # default value is false
      url_have_group_name = true
    # path(disk or mount point) count, default value is 1
    # must same as storage.conf
      store_path_count=1
    # store_path#, based 0, if store_path0 not exists, it''s value is base_path
    # the paths must be exist
    # must same as storage.conf
      store_path0=/home/fastdfs/storage
    # set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
    # empty for output to stderr (apache and nginx error_log file)
      log_filename=/home/www/logs/mod_fastdfs.log
    nginx 配置简洁版本
    #vim /usr/local/nginx/conf/nginx.conf
    user  www www;
    worker_processes  2;
    error_log  /home/www/logs/error.log  notice;
    pid        /home/www/logs/nginx.pid;
    
    worker_rlimit_nofile 5120;
    events {
        use epoll;
        worker_connections  5120;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        sendfile        on;
        tcp_nopush     on;
        keepalive_timeout  60;
        tcp_nodelay on;
    
        server {
            listen       80;
            server_name  localhost;
            location /group2/M00 {
                alias /home/fastdfs/storage/data;
                ngx_fastdfs_module;
            }
        }
    }
    
    #启动nginx
      /usr/local/nginx/sbin/nginx

5. 安装 Storage Server - 192.168.55.225

  • 参考 192.168.55.224 安装,不同点就是 192.168.55.224 是 group2 的源服务,storage.conf 配置不同,需要注意。

6. 测试及使用 fastdfs-192.168.55.222

  • fastdfs 之配置 client
    #修改 client.conf
      vim /usr/local/fastdfs/conf/client.conf
      base_path=/home/yuqing/fastdfs-> base_path=/home/fastdfs/tracker
      tracker_server=192.168.209.121:22122 -> tracker_server=192.168.55.222:22122
    #或
      sed -i ''s:base_path=.*:base_path=/home/fastdfs/tracker:g'' /usr/local/fastdfs/conf/client.conf
      sed -i ''s:tracker_server=.*:tracker_server=192.168.55.222\:22122:g'' /usr/local/fastdfs/conf/client.conf
    #upload
      cd /usr/local/fastdfs/bin
      ./fdfs_upload_file /usr/local/fastdfs/conf/client.conf /tmp/t1.jpg 
    #-——————————————————————————————————————
    #group1/M00/00/00/oYYBAFJNRnGASWekAAAXkpktHxI423.jpg
    查看文件信息
    ./fdfs_file_info /usr/local/fastdfs/conf/client.conf group1/M00/00/00/oYYBAFJNQiiAYIXzAAAXkpktHxI095.jpg
    #————————————————————————————————————————
    source storage id: 100001
    source ip address: 192.168.55.223
    file create timestamp: 2013-10-03 18:26:57
    file size: 6034
    file crc32: 2569871122 (0x992D1F12)
    测试上传
    ./fdfs_test /usr/local/fastdfs/conf/client.conf upload /tmp/t1.jpg 
    #————————————————————————————————————————
    This is FastDFS client test program v4.07
    
    Copyright (C) 2008, Happy Fish / YuQing
    
    FastDFS may be copied only under the terms of the GNU General
    Public License V3, which may be found in the FastDFS source kit.
    Please visit the FastDFS Home Page http://www.csource.org/ 
    for more detail.
    
    [2013-10-04 02:20:19] DEBUG - base_path=/home/fastdfs/tracker, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
    
    tracker_query_storage_store_list_without_group: 
            server 1. group_name=, ip_addr=192.168.55.223, port=23000
    
    group_name=group1, ip_addr=192.168.55.223, port=23000
    storage_upload_by_filename
    group_name=group1, remote_filename=M00/00/00/oYYBAFJNRWeAHhGuAAAXkpktHxI578.jpg
    source ip address: 192.168.55.223
    file timestamp=2013-10-03 18:22:31
    file size=6034
    file crc32=2569871122
    example file url: http://192.168.55.223/group1/M00/00/00/oYYBAFJNRWeAHhGuAAAXkpktHxI578.jpg
    storage_upload_slave_by_filename
    group_name=group1, remote_filename=M00/00/00/oYYBAFJNRWeAHhGuAAAXkpktHxI578_big.jpg
    source ip address: 192.168.55.223
    file timestamp=2013-10-03 18:22:31
    file size=6034
    file crc32=2569871122
    example file url: http://192.168.55.223/group1/M00/00/00/oYYBAFJNRWeAHhGuAAAXkpktHxI578_big.jpg

    在浏览器中 -->http://192.168.55.222/group1/M00/00/00/oYYBAFJNQiiAYIXzAAAXkpktHxI095.jpg
    输入上图中的 url 地址, tracker server 会自动重定向到存储文件的 storage server,文件下载成功。至此,已经成功搭建了 fastdfs。弄了两天,终于好了 - 0-:


  • 常规命令范例:
    #监控storage
    /usr/local/fastdfs/bin/fdfs_monitor /usr/local/fastdfs/conf/storage.conf
    #如果存在多个多个组,只需要监控其中一个组,就能调出所有组的状态
    
    #删除组内服务器storage和查看各个组内服务器状态
    /usr/local/fastdfs/bin/fdfs_monitor /usr/local/fastdfs/conf/client.conf delete group2 192.168.55.223
    /usr/local/fastdfs/bin/fdfs_monitor /usr/local/fastdfs/conf/client.conf
    storage server有7个状态,如下(数值从1~7):
    # FDFS_STORAGE_STATUS:INIT      :初始化,尚未得到同步已有数据的源服务器
    # FDFS_STORAGE_STATUS:WAIT_SYNC :等待同步,已得到同步已有数据的源服务器
    # FDFS_STORAGE_STATUS:SYNCING   :同步中
    # FDFS_STORAGE_STATUS:DELETED   :已删除,该服务器从本组中摘除
    # FDFS_STORAGE_STATUS:OFFLINE   :离线
    # FDFS_STORAGE_STATUS:ONLINE    :在线,尚不能提供服务
    # FDFS_STORAGE_STATUS:ACTIVE    :在线,可以提供服务
  • 常用操作命令
    #调整防火墙的规则,开放端口:22122
      iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 22122 -j ACCEPT
      /etc/init.d/iptables save
    
    #调整防火墙的规则,开放端口:23000
      iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 23000 -j ACCEPT
      /etc/init.d/iptables save
     
    #启动tracker进程:
      /etc/init.d/fdfs_trackerd start
    
    #查看trackerd状态:
      /etc/init.d/fdfs_trackerd status
    
    #查看trackerd监听的端口:
      netstat -plantu | grep tracker
    
    #启动Storage进程:
      /etc/init.d/fdfs_storaged start
    
    #查看Storage进程:
      ps -ef | grep storaged | grep -v grep
FastDFS 原理 

    存储节点采用了分组(group)的方式。存储系统由一个或多个 group 组成,group 与 group 之间的文件是相互独立的,所有 group 的文件容量累加就是整个存储系统中的文件容量。一个 group 可以由一台或多台存储服务器组成,一个 group 下的存储服务器中的文件都是相同的,group 中的多台存储服务器起到了冗余备份和负载均衡的作用(一个组的存储容量为该组内存储服务器容量最小的那个,不同组的 Storage server 之间不会相互通信,同组内的 Storage server 之间会相互连接进行文件同步)。

    在 group 中增加服务器时,同步已有的文件由系统自动完成,同步完成后,系统自动将新增服务器切换到线上提供服务。

    当存储空间不足或即将耗尽时,可以动态添加 group。只需要增加一台或多台服务器,并将它们配置为一个新的 group,这样就扩大了存储系统的容量。

    FastDFS 只有两个角色:Tracker server 和 Storage server。Tracker server 作为中心结点,其主要作用是负载均衡和调度。Tracker server 在内存中记录分组和 Storage server 的状态等信息,不记录文件索引信息,占用的内存量很少。另外,客户端(应用)和 Storage server 访问 Tracker server 时,Tracker server 扫描内存中的分组和 Storage server 信息,然后给出应答。由此可以看出 Tracker server 非常轻量化,不会成为系统瓶颈。

    FastDFS 中的 Storage server 在其他文件系统中通常称作 Trunk server 或 Data server。Storage server 直接利用 OS 的文件系统存储文件。FastDFS 不会对文件进行分块存储,客户端上传的文件和 Storage server 上的文件一一对应(FastDFS 中的文件标识分为两个部分:组名和文件名,二者缺一不可)

能够完成基于这两个作者的博文,wangying 、 zrwm  thk。

CentOS7(64)环境使用 rpm 命令安装 gcc

CentOS7(64)环境使用 rpm 命令安装 gcc

第一步:下载 gcc 相关的安装文件
下载地址:http://vault.centos.org/7.0.1406/os/x86_64/Packages/

下载以下文件:

cpp-4.8.2-16.el7.x86_64.rpm
gcc-4.8.2-16.el7.x86_64.rpm
glibc-2.17-55.el7.x86_64.rpm
glibc-common-2.17-55.el7.x86_64.rpm
glibc-devel-2.17-55.el7.x86_64.rpm
glibc-headers-2.17-55.el7.x86_64.rpm
glibc-static-2.17-55.el7.x86_64.rpm
glibc-utils-2.17-55.el7.x86_64.rpm
kernel-headers-3.10.0-123.el7.x86_64.rpm
libmpc-1.0.1-3.el7.x86_64.rpm

mpfr-3.1.1-4.el7.x86_64.rpm

第二步:创建目录 rpm_tmp

mkdir rpm_tmp
 

第三步:将以上文件上传到 rpm_tmp

第四步:执行安装操作

  1.  
    cd rpm_tmp
  2.  
    rpm -Uvh *.rpm --nodeps --force

运行此命令会根据依赖按照顺序安装 rpm
注:
--nodeps rpm 在安装包时,不检查依赖关系,例如安装 B,B 依赖 C 导致无法安装,使用 --nodeps 就可以安装成功 

--force 强制安装

第五步:验证安装结果

gcc -V

 

Cocos2D-x 入门(2) win7(64)+VS2013+cocos2d-x 3.6环境配置

Cocos2D-x 入门(2) win7(64)+VS2013+cocos2d-x 3.6环境配置

参考: 在Windows7上搭建Cocos2d-x 3.2alpha0开发环境
http://www.cocos.com/doc/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/native/v3/getting-started/setting-up-development-environments-on-windows7-with-vs2013/zh.md
1. 下载并安装VS2013.
cn_visual_studio_ultimate_2013_with_update_4_x86_dvd_5935081.iso
2. 下载并安装Python 2.7.10 (我是用的这个版本,3.0以后的版本不得行)
并配置环境变量。参考最上的链接。
3. 下载cocos2d-x 3.6
http://www.cocos2d-x.org/download 左下角“DOWNLOAD V3.6”即可。
4. 解压并打开bulid目录下的cocos2d-win32.vc2012.sln,生成解决方案,有8个项目,需要一点时间。
5. 设置cpp-tests为启动项,运行则有界面:

6. 运行cmd,切换目录到cocos2d-x-3.6\tools\cocos2d-console\bin 下:
我的是:D:\cocosDevelop\cocos2d-x-3.6\tools\cocos2d-console\bin
(最方便的是直接进入目录下,按住shift右击,选择在当前位置打开命令窗口。)
7. 使用cocos.py 创建新项目helloworld。
命令如下:
D:\cocosDevelop\cocos2d-x-3.6\tools\cocos2d-console\bin>
python cocos.py new Demo -p com.coco2dx.org -l cpp -d D:\cocosDevelop\projs

new之后 表示项目文件夹名称

-l 表示项目创建的类型,包括cpp,lua,js

-p表示项目包的名称

-d表示项目存放的目录

  1. 无误后找到目录(我的是D:\cocosDevelop\projs\Demo)下的proj.win32下的Demo.sln打开,
    编译运行,成功后界面:

关于在win764上用vs2013的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于C ++ CreateProcess在Windows 7上从套接字接收path失败(64)、CentOS 6.3(64) ---> fastdfs_v4.07 / 实现多服务器、CentOS7(64)环境使用 rpm 命令安装 gcc、Cocos2D-x 入门(2) win7(64)+VS2013+cocos2d-x 3.6环境配置的相关信息,请在本站寻找。

本文标签: