一、RocketMQ简介:

RocketMQ是一款分布式、队列模型的消息中间件,具有以下特点:

1、支持严格的消息顺序;

2、支持Topic与Queue两种模式;

3、亿级消息堆积能力;

4、比较友好的分布式特性;

5、同时支持Push与Pull方式消费消息;

官网链接:

rocketmq下载地址:  https://github.com/alibaba/RocketMQ/releases

rocketmq github:     https://github.com/alibaba/RocketMQ

RocketMQ集群安装:

RocketMQ有多种集群的方式,这里是双master的集群.

优点:优点:配置简单,消息也不会丢(异步刷盘丢失少量消息,同步刷盘一条不丢)性能最高

一、前期准备

主机(两台)为centOs6.5系统,ip对应主机名如下:

10.10.10.23 rocketmq-master1   #ip和主机名
10.10.10.24 rocketmq-master2

所需软件:

jdk1..0_45.tar.gz          #jdk软件
alibaba-rocketmq-.tar.gz      #mq软件包

hosts信息添加:(两台主机均的添加hosts)

# vim /etc/hosts
10.10.10.23     mqnameserver1      #ip对应brokerName
10.10.10.24     mqnameserver2
10.10.10.23     rocketmq-master1        #ip对应主机名
10.10.10.24     rocketmq-master2        #ip对应主机名

二、安装

1.>安装JDK

 jdk1.6.0_45.tar.gz     #软件包
 #tar -zxvf jdk1.6.0_45.tar.gz -C /apps/product/
 #ln -s /apps/product/jdk1.6.0_45 java

 #环境变量配置
 #vim /etc/profile
 JAVA_HOME=/apps/product/java
 CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
 PATH=$JAVA_HOME/bin:$PATH
 export JAVA_HOME CLASSPATH PATH 

 source /etc/profile
 查看jdk版本:java -version

2.>RocketMQ安装: (mq版本:3.2.6)

 >>tar -zxvf alibaba-rocketmq-3.2.6.tar.gz -C /apps/product/
 >>cd /apps/product/
 >>mv alibaba-rocketmq-3.2.6  rocketmq

 环境变量设置:
 >>vim /etc/profile
 JAVA_HOME=/apps/product/java
 CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
 PATH=$JAVA_HOME/bin:$PATH
 ROCKETMQ_HOME=/apps/product/rocketmq
 export JAVA_HOME CLASSPATH PATH ROCKETMQ_HOME

 >>source /etc/profile

 >>useradd admin
 >>cd /apps/product/rocketmq/bin && sh os.sh

3.RocketMQ配置:

部署Broker:消息中转角色,负责存储消息,转发消息

Broker配置参数:

1.>获取Broker的默认配置
sh mqbroker -m
2.>Broker启动时,如何加载配置
生成Broker默认配置模版
sh mqbroker -m >broker.p

3.>修改配置文件.
broker.p

4.>加载修改过的配置文件
nohup sh mqbroker -c broker.p  #将broker.p文件复制到broker-a.properties文件,并可以添加其他配置.

(1)、Master1服务器(10.10.10.23)

 vim /apps/product/rocketmq/conf/2m-noslave/broker-a.properties

 rocketmqHome=/apps/product/rocketmq
 namesrvAddr=10.10.10.23:9876;10.10.10.24:9876
 brokerIP1=10.10.10.23
 brokerName=rocketmq-master1
 brokerClusterName=DefaultCluster
 brokerId=0
 autoCreateTopicEnable=false
 autoCreateSubscriptionGroup=true
 rejectTransactionMessage=false
 fetchNamesrvAddrByAddressServer=false
 storePathRootDir=/root/store
 storePathCommitLog=/root/store/commitlog
 flushIntervalCommitLog=1000
 flushCommitLogTimed=false
 deleteWhen=04
 fileReservedTime=72
 diskMaxUsedSpaceRatio=88
 maxTransferBytesOnMessageInMemory=262144
 maxTransferCountOnMessageInMemory=32
 maxTransferBytesOnMessageInDisk=65536
 maxTransferCountOnMessageInDisk=8
 accessMessageInMemoryMaxRatio=40
 messageIndexEnable=true
 messageIndexSafe=false
 haMasterAddress=
 brokerRole=ASYNC_MASTER
 flushDiskType=ASYNC_FLUSH
 cleanFileForciblyEnable=true
 sendMessageThreadPoolNums=128
 pullMessageThreadPoolNums=128
 brokerPermission=6
 defaultTopicQueueNums=8
 clusterTopicEnable=true
 brokerTopicEnable=true
 adminBrokerThreadPoolNums=16
 clientManageThreadPoolNums=16
 flushConsumerOffsetInterval=5000
 flushConsumerOffsetHistoryInterval=60000
 sendThreadPoolQueueCapacity=100000
 pullThreadPoolQueueCapacity=100000
 filterServerNums=0
 longPollingEnable=true
 shortPollingTimeMills=1000
 notifyConsumerIdsChangedEnable=true
 offsetCheckInSlave=false
 listenPort=10911
 serverWorkerThreads=8
 serverCallbackExecutorThreads=0
 serverSelectorThreads=3
 serverOnewaySemaphoreValue=256
 serverAsyncSemaphoreValue=64
 serverChannelMaxIdleTimeSeconds=120
 serverSocketSndBufSize=131072
 serverSocketRcvBufSize=131072
 serverPooledByteBufAllocatorEnable=false
 clientWorkerThreads=4
 clientCallbackExecutorThreads=2
 clientOnewaySemaphoreValue=2048
 clientAsyncSemaphoreValue=2048
 connectTimeoutMillis=3000
 channelNotActiveInterval=60000
 clientChannelMaxIdleTimeSeconds=120
 clientSocketSndBufSize=131072
 clientSocketRcvBufSize=131072
 clientPooledByteBufAllocatorEnable=false
 mapedFileSizeCommitLog=1073741824
 mapedFileSizeConsumeQueue=6000000
 flushIntervalConsumeQueue=1000
 cleanResourceInterval=10000
 deleteCommitLogFilesInterval=100
 deleteConsumeQueueFilesInterval=100
 destroyMapedFileIntervalForcibly=120000
 redeleteHangedFileInterval=120000
 diskMaxUsedSpaceRatio=75
 putMsgIndexHightWater=600000
 maxMessageSize=524288
 checkCRCOnRecover=true
 flushCommitLogLeastPages=4
 flushConsumeQueueLeastPages=2
 flushCommitLogThoroughInterval=10000
 flushConsumeQueueThoroughInterval=60000
 maxHashSlotNum=5000000
 maxIndexNum=20000000
 maxMsgsNumBatch=64
 haListenPort=10912
 haSendHeartbeatInterval=5000
 haHousekeepingInterval=20000
 haTransferBatchSize=32768
 haSlaveFallbehindMax=268435456
 syncFlushTimeout=5000
 messageDelayLevel=1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
 flushDelayOffsetInterval=10000

broker-a.properties

(2)、Master2服务器(10.10.10.24)

 vim /apps/product/rocketmq/conf/2m-noslave/broker-b.properties 

 rocketmqHome=/apps/product/rocketmq
 namesrvAddr=10.10.10.24:9876;10.10.10.23:9876
 brokerIP1=10.10.10.24
 brokerName=rocketmq-master2
 brokerClusterName=DefaultCluster
 brokerId=0
 autoCreateTopicEnable=false
 autoCreateSubscriptionGroup=true
 rejectTransactionMessage=false
 fetchNamesrvAddrByAddressServer=false
 storePathRootDir=/root/store
 storePathCommitLog=/root/store/commitlog
 flushIntervalCommitLog=1000
 flushCommitLogTimed=false
 deleteWhen=04
 fileReservedTime=72
 diskMaxUsedSpaceRatio=88
 maxTransferBytesOnMessageInMemory=262144
 maxTransferCountOnMessageInMemory=32
 maxTransferBytesOnMessageInDisk=65536
 maxTransferCountOnMessageInDisk=8
 accessMessageInMemoryMaxRatio=40
 messageIndexEnable=true
 messageIndexSafe=false
 haMasterAddress=
 brokerRole=ASYNC_MASTER
 flushDiskType=ASYNC_FLUSH
 cleanFileForciblyEnable=true
 sendMessageThreadPoolNums=128
 pullMessageThreadPoolNums=128
 brokerPermission=6
 defaultTopicQueueNums=8
 clusterTopicEnable=true
 brokerTopicEnable=true
 adminBrokerThreadPoolNums=16
 clientManageThreadPoolNums=16
 flushConsumerOffsetInterval=5000
 flushConsumerOffsetHistoryInterval=60000
 sendThreadPoolQueueCapacity=100000
 pullThreadPoolQueueCapacity=100000
 filterServerNums=0
 longPollingEnable=true
 shortPollingTimeMills=1000
 notifyConsumerIdsChangedEnable=true
 offsetCheckInSlave=false
 listenPort=10911
 serverWorkerThreads=8
 serverCallbackExecutorThreads=0
 serverSelectorThreads=3
 serverOnewaySemaphoreValue=256
 serverAsyncSemaphoreValue=64
 serverChannelMaxIdleTimeSeconds=120
 serverSocketSndBufSize=131072
 serverSocketRcvBufSize=131072
 serverPooledByteBufAllocatorEnable=false
 clientWorkerThreads=4
 clientCallbackExecutorThreads=2
 clientOnewaySemaphoreValue=2048
 clientAsyncSemaphoreValue=2048
 connectTimeoutMillis=3000
 channelNotActiveInterval=60000
 clientChannelMaxIdleTimeSeconds=120
 clientSocketSndBufSize=131072
 clientSocketRcvBufSize=131072
 clientPooledByteBufAllocatorEnable=false
 mapedFileSizeCommitLog=1073741824
 mapedFileSizeConsumeQueue=6000000
 flushIntervalConsumeQueue=1000
 cleanResourceInterval=10000
 deleteCommitLogFilesInterval=100
 deleteConsumeQueueFilesInterval=100
 destroyMapedFileIntervalForcibly=120000
 redeleteHangedFileInterval=120000
 diskMaxUsedSpaceRatio=75
 putMsgIndexHightWater=600000
 maxMessageSize=524288
 checkCRCOnRecover=true
 flushCommitLogLeastPages=4
 flushConsumeQueueLeastPages=2
 flushCommitLogThoroughInterval=10000
 flushConsumeQueueThoroughInterval=60000
 maxHashSlotNum=5000000
 maxIndexNum=20000000
 maxMsgsNumBatch=64
 haListenPort=10912
 haSendHeartbeatInterval=5000
 haHousekeepingInterval=20000
 haTransferBatchSize=32768
 haSlaveFallbehindMax=268435456
 syncFlushTimeout=5000
 messageDelayLevel=1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
 flushDelayOffsetInterval=10000

broker-b.properties

配置解析注释文件:

 ## Broker对外服务的监听端口
 listenPort = 10911
 ## Name Server地址
 namesrvAddr=192.168.3.229:9876
 ##本机IP地址,默认系统自动识别,但是某些多网卡机器会存在识别错误的情况,这种情况下可以人工配置
 brokerIP1=192.168.3.229
 ##本机主机名
 brokerName=dev10.com
 ##Broker所属哪个集群,其中缺省值为DefaultCluster
 brokerClusterName=DefaultCluster
 ## BrokerId,必须是大等于0的整数,0表示Master,>0表示Slave,一个Master可以挂多个Slave,Master与Slave通过BrokerName来配对
 brokerId=0
 ##是否允许Broker自动创建Topic,建议线下开启,线上关闭
 autoCreateTopicEnable=true   //线上改为false
 ##是否允许Broker自动创建订阅组,建议线下开启,线上关闭
 autoCreateSubscriptionGroup=true  //线上改为false
 ##是否拒绝事务消息接入
 rejectTransactionMessage=false
 ##是否从web服务器获取Name Server地址,针对大规模的Broker集群建议使用这种方式
 fetchNamesrvAddrByAddressServer=false
 ## commitLog存储路径 $HOME/store/commitlog
 storePathCommitLog=/root/store/commitlog
 ##消费队列存储路径  $HOME/store/consumequeue
 storePathConsumeQueue=/root/store/consumequeue
 ##消息索引存储路径 $HOME/store/index
 storePathIndex=/root/store/index
 ## checkpoint文件存储路径 $HOME/store/checkpoint
 storeCheckpoint=/root/store/checkpoint
 ##异常退出产生的文件-//abort文件存储路径 $HOME/store/abort
 abortFile=/root/store/abort
 ##删除文件时间点,默认凌晨4点
 deleteWhen=04
 ##文件保留时间,默认48小时
 fileReservedTime=72
 ##单次Pull消息(内存)传输的最大字节数
 maxTransferBytesOnMessageInMemory=262144
 ##单次Pull消息(内存)传输的最大条数
 maxTransferCountOnMessageInMemory=32
 ##单次Pull消息(磁盘)传输的最大字节数
 maxTransferBytesOnMessageInDisk=65536
 ##单次Pull消息(磁盘)传输的最大条数
 maxTransferCountOnMessageInDisk=8
 ##命中消息在内存的最大比例
 accessMessageInMemoryMaxRatio=40
 ##是否开启消息索引功能
 messageIndexEnable=true
 ##是否提供安全的消息索引机制,索引保证不丢
 messageIndexSafe=false ⇒ 线上改为true
 ##在Slave上直接设置Master地址,默认从Name Server上自动获取,也可以手工强制配置
 haMasterAddress=
 ## Broker的角色 - ASYNC_MASTER异步复制Master-SYNC_MASTER同步双写Master-SLAVE
 brokerRole=ASYNC_MASTER
 ##刷盘方式 - ASYNC_FLUSH 异步刷盘 - SYNC_FLUSH 同步刷盘
 flushDiskType=ASYNC_FLUSH
 ##磁盘满、且无过期文件情况下 TRUE 表示强制删除文件,优先保证服务可用 FALSE 标记服务不可用,文件不删除
 cleanFileForciblyEnable=true
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~非默认配置~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ##服务器服务权限 默认值6 6 读写 4 只读 2只写
 brokerPermission=6
 ##默认8 ,topic的queue数
 defaultTopicQueueNums=4
 ##默认 true 自动创建以集群名字命名的Topic功能
 clusterTopicEnable=true
 ##发送消息线程数 32+cpu*4
 sendMessageThreadPoolNums=16
 ##拉消息处理线程数 32+cpu*4
 pullMessageThreadPoolNums=16
 ##管控命令处理线程数 8
 adminBrokerThreadPoolNums=8
 ##Topic持久化路径 $HOME/store/config/topics.json
 topicConfigPath=/root/store/config/topics.json
 ##ConsumerOffset  $HOME /store/config/topics.json
 consumerOffsetPath=/root/store/config/consumerOffset.json
 ##Broker 配置文件路径 $HOME /store/config/broker.properties
 #brokerConfigPath=/root/store/config /broker.properties
 ##subscriptionGroup 持久化路径 $HOME /store/config/topics.json
 subscriptionGroupPath=/root/store/config /subscriptionGroup.json
 ##刷消费进度 时间 默认5秒
 flushConsumerOffsetInterval=5000
 ##消费进度历史统计 60秒
 flushConsumerOffsetHistoryInterval=60000
 ##查询消息最大时间跨度,单位小时 默认3小时
 queryMessageMaxTimeSpan=3
 =================== NettyServerConfig===================
 ##netty worker线程数默认 32
 serverWorkerThreads=32
 ##CallbackExecutor 默认是0 ,0表示系统值
 serverCallbackExecutorThreads=0
 ##netty selector 线程 默认 8
 serverSelectorThreads=8
 ##Oneway方式处理线程
 serverOnewaySemaphoreValue=32
 ##Async方式处理线程
 serverAsyncSemaphoreValue=64
 ##通信层最大空闲时间 默认120秒
 serverChannelMaxIdleTimeSeconds=120
 ==================== NettyClientConfig=====================
 ##clientWorker 线程 4
 clientWorkerThreads=4
 ##CallbackExecutor
 clientCallbackExecutorThreads=4
 ###clientSelector 1
 clientSelectorThreads=1
 ##clientOneway 默认 256 事务会查时可以多些
 clientOnewaySemaphoreValue=56
 ##clientAsync 默认 128 暂时无太多用途
 clientAsyncSemaphoreValue=28
 ##连接超时时间 3秒
 connectTimeoutMillis=3000
 ##channel 不活动时间 无心跳时间 6秒
 channelNotActiveInterval=60000
 ##channel 空闲时间 120秒
 clientChannelMaxIdleTimeSeconds=120

 =============== MessageStoreConfig===========================
 ##CommitLog每个文件大小 1G
 mapedFileSizeCommitLog=1073741824
 ##ConsumeQueue每个文件大小 默认存储50W条消息*8
 mapedFileSizeConsumeQueue=10000000
 ##CommitLog刷盘间隔时间(单位毫秒)
 flushIntervalCommitLog=1000
 ##ConsumeQueue刷盘间隔时间(单位毫秒)
 flushIntervalConsumeQueue=1000
 ##清理资源间隔时间(单位毫秒)10秒
 cleanResourceInterval=10000
 ##删除多个CommitLog文件的间隔时间(单位毫秒)
 deleteCommitLogFilesInterval=100
 ##删除多个ConsumeQueue文件的间隔时间(单位毫秒)
 deleteConsumeQueueFilesInterval=100
 ##强制删除文件间隔时间(单位毫秒)120秒
 destroyMapedFileIntervalForcibly=120000
 ##定期检查Hanged文件间隔时间(单位毫秒)120秒
 redeleteHangedFileInterval=120000
 ##磁盘空间最大使用率75%
 diskMaxUsedSpaceRatio=75
 ##写消息索引到ConsumeQueue,缓冲区高水位,超过则开始流控 600000
 putMsgIndexHightWater=600000
 ##最大消息大小,默认512K 1M
 maxMessageSize=1050000
 ##重启时,是否校验CRC 默认是true
 checkCRCOnRecover=true
 ##刷CommitLog,至少刷几个PAGE
 flushCommitLogLeastPages=4
 ##刷ConsumeQueue,至少刷几个PAGE
 flushConsumeQueueLeastPages=2
 ##刷CommitLog,彻底刷盘间隔时间 10秒
 flushCommitLogThoroughInterval=10000
 ##刷ConsumeQueue,彻底刷盘间隔时间 60秒
 flushConsumeQueueThoroughInterval=60000
 ##最大被拉取的消息个数,消息在内存 ?
 maxTransferCountOnMessageInMemory=32
 maxHashSlotNum=5000000
 maxIndexNum=20000000
 最大key查找拉取条数
 maxMsgsNumBatch=32
 ========================集群配置部分,非集群不添加====================
 ###HA功能 端口号----非集群不加该配置
 haListenPort=10912
 ##HA心跳间隔 5秒
 haSendHeartbeatInterval=5000
 ###HA保持时间20秒
 haHousekeepingInterval=20000
 ###HA最大一次传输 32k
 haTransferBatchSize=32768
 ###如果不设置,则从NameServer获取Master HA服务地址
 #haMasterAddress=
 ###Slave落后Master超过此值,则认为存在异常 1024 * 1024 * 256 256M
 #haSlaveFallbehindMax=268435456

Broker参数解析

(3)、runbroker.sh参数调整

vim /apps/product/rocketmq/bin/runbroker.sh
runbroker.sh需要根据内存大小进行适当地调整

JAVA_OPT_1="-server-Xms8g -Xmx8g -Xmn2g -XX:PermSize=1g -XX:MaxPermSize=1g"

服务启动:

mkdir -p /data/rocketmq/store/commitlog /data/logs    #创建日志存放目录

>>cd /apps/product/rocketmq/conf && sed -i 's#${user.home}#/data#g' *.xml    #更改为data目录

(1)、启动NameServer【两台启动方式相同】

> cd /apps/product/rocketmq/bin
> nohup sh mqnamesrv &                 或者 nohup sh mqnamesrv > nohup.out 2>&1 &

(2)、启动BrokerServer A【10.10.10.23主机】

cd /apps/product/rocketmq/bin
nohup sh mqbroker -c ../conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &     或者

#nohup sh mqbroker -n 10.10.10.23:9876 -c ../conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &

(3)、启动BrokerServer B【10.10.10.24主机】

 > cd /apps/product/rocketmq/bin
 nohup sh mqbroker -c ../conf/2m-noslave/broker-b.properties  >/dev/null 2>&1 &

# nohup sh mqbroker -n 10.10.10.24:9876 -c ../conf/2m-noslave/broker-b.properties  >/dev/null 2>&1 & 

(4)、测试:

两台机器分别查看日志信息:  tail -100f /data/logs/rocketmqlogs/namesrv.log

               tail -100f /data/logs/rocketmqlogs/broker.log

#netstat -ntlp   #查看端口号

# jps       #查看服务

后台启动并生产日志:  nohup sh mqnamesrv >& /var/log/ns.log

分布式消息队列RocketMQ部署的更多相关文章

  1. Linux分布式消息队列RocketMQ部署与监控--双Master

    环境准备:CentOS_6.5_x64 IP: 192.168.0.249 dbTest249  Master1 IP: 192.168.0.251 webTest251 Master2 下载 ali ...

  2. 分布式消息队列RocketMQ(一)安装与启动

    分布式消息队列RocketMQ 一.RocketMQ简介 RocketMQ(火箭MQ) 出自于阿里,后开源给apache成为apache的顶级开源项目之一,顶住了淘宝10年的 双11压力 是电商产品的 ...

  3. (原创)Rocketmq分布式消息队列的部署与监控

    -------------------------------------------------------------------------------------------- 一.Rocke ...

  4. 分布式消息队列RocketMQ与Kafka架构上的巨大差异

    分布式消息服务 Kafka 是一个高吞吐.高可用的消息中间件服务,适用于构建实时数据管道.流式数据处理.第三方解耦.流量削峰去谷等场景,具有大规模.高可靠.高并发访问.可扩展且完全托管的特点,是分布式 ...

  5. 分布式消息列队RocketMQ部署

    模式: 多Master多Slave模式,异步复制: 每个 Master 配置一个 Slave,有多对Master-Slave,HA 采用异步复制方式,主备有短暂消息延迟,毫秒级. 优点:即使磁盘损坏, ...

  6. 分布式消息队列RocketMQ与Kafka架构上的巨大差异之1 -- 为什么RocketMQ要去除ZK依赖?

    我们知道,在早期的RocketMQ版本中,是有依赖ZK的.而现在的版本中,是去掉了对ZK的依赖,转而使用自己开发的NameSrv. 并且这个NameSrv是无状态的,你可以随意的部署多台,其代码也非常 ...

  7. 分布式消息队列RocketMQ&Kafka -- 消息的“顺序消费”

    在说到消息中间件的时候,我们通常都会谈到一个特性:消息的顺序消费问题.这个问题看起来很简单:Producer发送消息1, 2, 3... Consumer按1, 2, 3...顺序消费. 但实际情况却 ...

  8. RocketMQ 消息队列单机部署及使用

    转载请注明来源:http://blog.csdn.net/loongshawn/article/details/51086876 相关文章: <RocketMQ 消息队列单机部署及使用> ...

  9. C#分布式消息队列 EQueue 2.0 发布啦

    前言 最近花了我几个月的业余时间,对EQueue做了一个重大的改造,消息持久化采用本地写文件的方式.到现在为止,总算完成了,所以第一时间写文章分享给大家这段时间我所积累的一些成果. EQueue开源地 ...

随机推荐

  1. 51nod 1109 bfs

    给定一个自然数N,找出一个M,使得M > 0且M是N的倍数,并且M的10进制表示只包含0或1.求最小的M.   例如:N = 4,M = 100. Input 输入1个数N.(1 <= N ...

  2. Spring不支持依赖注入static静态变量

    在springframework里,我们不能@Autowired一个静态变量,使之成为一个spring bean,例如下面这样: 可以试一下,yourClass在这种状态下不能够被依赖注入,会抛出运行 ...

  3. SSM框架搭建(转发)

    SSM框架,顾名思义,就是Spring+SpringMVC+mybatis. 通过Spring来将各层进行整合, 通过spring来管理持久层(mybatis), 通过spring来管理handler ...

  4. SQL怎么输出前n个记录? n是中间计算得到的,不支持变量传递

    需求: 表 people_crowed_test 按view_num排序后,输出该表的记录前30%的aid, buyer_id; 需求场景下的诸多限制: 1) 不支持变量赋值,也就是无法把中间结果保存 ...

  5. js-FCC算法-Symmetric Difference

    创建一个函数,接受两个或多个数组,返回所给数组的 对等差分(symmetric difference) (△ or ⊕)数组. 给出两个集合 (如集合 A = {1, 2, 3} 和集合 B = {2 ...

  6. 【poj1112】 Team Them Up!

    http://poj.org/problem?id=1112 (题目链接) 题意 将n个人分成两组,每个人有认识的人,要求每一组中的人互相认识,并且两组人数之差尽可能的小,求如何分. Solution ...

  7. Bzoj1823 [JSOI2010]满汉全席

    Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 1640  Solved: 798 Description 满汉全席是中国最丰盛的宴客菜肴,有许多种不同的 ...

  8. 主机宝(zhujibao) /a/apps/zhujibao/manager/apps/config/config.php no-password Login Vulnerabilities Based On Default cookie Verification From Default File

    catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 主机宝管理程序使用了CodeIgniter框架,要想在CodeIgnit ...

  9. 几个pointer

    [备份]了解initramfs,越往深处走觉着需要了解的东西越多,所以干脆回来,从实际系统的实现开始寻迹.在学习的这个系统中,里面用了busybox,实现的系统可谓精简之又精简.早上主要学习了root ...

  10. Swift 吐槽下Swift里一个逼死强迫症的语法:中缀语法

    中缀语法是OC里特有的一种,就是在函数的参数前面加一个解释词,让调用的时候明白该参数的含义 比如: -(void)processDataWithparamaA:(NSString *)paramaA ...