服务器搭建

1.安装RubyGems

再安装RubyGems之前需要先安装Ruby

然后到RubyGems.zip的解压目录下,找到setup.rb文件,在当前路径下按住shift+右键,选择在此处打开命令窗口

然后输入:ruby setup.rb

gem sources --remove https://rubygems.org/ 删掉原来的源
gem sources -a http://gems.ruby-china.org 添加国内镜像源
gem sources -l 查看现有的源
gem install redis 安装redis依赖

2.WCF跨域设置,配置如下:

<services>
      <service name="YT.DownloadFile.MapService">
        <endpoint address="" behaviorConfiguration="YT.DownloadFile.MapServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="YT.DownloadFile.MapService" bindingConfiguration="HttpJsonBinding"/>
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="HttpJsonBinding" crossDomainScriptAccessEnabled="true"></binding>
      </webHttpBinding>
    </bindings>

 3.wcf mime类型

.svc

application/octet-stream

4.WCF需要在Windows功能中安装WCF Services——HTTP Activation

5.C# Redis 集群配置

ConfigurationOptions option = new ConfigurationOptions();

            option.EndPoints.Add("127.0.0.1", 6379);

            option.EndPoints.Add("127.0.0.1", 6380);

            option.EndPoints.Add("127.0.0.1", 6381);

             _redis = ConnectionMultiplexer.Connect(option);

            _db = _redis.GetDatabase();

6.Redis内存配置

maxmemory 最大可用内存

maxmemory-policy 超过最大内存淘汰规则

取值参考:

volatile-lru 使用LRU算法删除一个键(只对设置了生存时间的键)
allkeys-lru 使用LRU算法删除一个键
volatile-random 随机删除一个键(只对设置了生存时间的键)
allkeys-random 随机删除一个键
volatile-ttl 删除生存时间最近的一个键
noeviction 不删除键,只返回错误

7.Redis持久化

rdb持久化:

save/bgsave 前者持久化所有数据,后者可能会丢失部分数据,但前者在主线程工作,可能造成阻塞,后者子线程工作

aof持久化:

appendonly yes 开启aof持久化

appendsync everysec每秒持久化一次

8.Redis远程配置(主从配置——配置主从就不能配置集群,注释掉所有cluster相关)

bind 本地ip(比如有两个服务器,192.168.158.26 和192.168.158.27),则在redis.conf中分别bind各自ip

远程访问:redis-cli -h 192.168.158.26 -p 6380

9.安装Redis为windows服务

redis-server --service-install redis.windows.conf --service-name redisService1

卸载:

redis-server --service-uninstall --service-name redisService1

启动服务:

redis-server --service-start --service-name redisService1

停止服务:

redis-server --service-stop --service-name redisService1

原文地址:https://www.cnblogs.com/ytwy/p/6936773.html