Untitled Post - 165
V$ARCHIVED_LOG视图中的列DEST_ID指定的值N就是LOG_ARCHIVE_DEST_N参数中的那个N,也就是DEST_ID用来指定是哪一个归档目标的日志记录。
V$ARCHIVED_LOG视图中的列DEST_ID指定的值N就是LOG_ARCHIVE_DEST_N参数中的那个N,也就是DEST_ID用来指定是哪一个归档目标的日志记录。
执行COPY命令时,出现Batch too large错误:
1 | cqlsh:reis> COPY image FROM 'image.csv'; |
/var/log/cassandra/system.log文件中可见:
1 | ERROR \[SharedPool-Worker-1\] 2016-07-15 15:07:20,725 BatchStatement.java:267 - Batch of prepared statements for \[reis.image\] is of size 2732525, exceeding specified threshold of 614400 by 2118125. (see batch_size_fail_threshold_in_kb) |
batch就是批量执行DML语句. 因为我的image表中有大字段,用于存储图片,每个图片不超过500K,所以遭遇了batch too large错误.
/etc/cassandra/cassandra.yaml文件中,参数batch_size_fail_threshold_in_kb的默认值只有50,一条DML语句就超过了这个阈值.
所以将此参数设置为600
1 | batch_size_fail_threshold_in_kb: 600 |
然后将COPY命令的批操作限制为1:
1 | cqlsh:reis> COPY image FROM 'image.csv' WITH MAXBATCHSIZE = 1 and MINBATCHSIZE = 1; |
顺利的导入了所有数据.
===
[erq]
activemq官方提供了init脚本
添加运行activemq的用户:
1 | # useradd -m activemq -d /srv/activemq |
安装activemq
1 | $ cd /srv/activemq |
修改activemq默认配置,使用activemq用户来运行activemq
1 | # cp apache-activemq-<version>/bin/env /etc/default/activemq |
安装init脚本:
1 | # ln -snf /srv/activemq/current/bin/activemq /etc/init.d/activemq |
===
[erq]
安装完成后,首先要启用默认实例:
1 | # ln -sf /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main |
然后以debug方式启动activemq的main实例:
1 | # /etc/init.d/activemq console main |
会有错误提示:
1 | ERROR Temporary Store limit is 50000 mb, whilst the temporary data directory: /var/lib/activemq/main/data/localhost/tmp_storage only has 3346 mb of usable space |
这是因为硬盘空间不够了,需要更改配置文件/etc/activemq/instances-enabled/main/activemq.xml,broker节内添加以下行:
1 | <systemUsage> |
如果不配置storeUsage,会有这样的错误提示:
1 | ERROR Store limit is 0 mb, whilst the max journal file size for the store is: 32 mb, the store will not accept any data when used. |
References:
[1]Temporary Store Limit Error When Starting the Broker
===
[erq]
如果cqlsh执行COPY命令时出现错误”get_num_processes() takes no keyword arguments”,删除掉/usr/lib/pymodules/python2.7/cqlshlib/copyutil.so文件,如果有文件copyutil.c也删除掉就可以了。
为了防止意外,cassandra不允许更改节点的数据中心和机架名字。会有类似错误提示:
1 | ERROR \[main\] 2016-06-18 11:01:40,730 CassandraDaemon.java:638 - Cannot start node if snitch's |
如果你知道你在做什么,可以添加两个JVM参数cassandra.ignore_rack和cassandra.ignore_dc来更改数据中心和机架的名字。
编辑/etc/cassandra/cassandra-env.sh文件,添加JVM参数:
1 | JVM_OPTS="$JVM_OPTS -Dcassandra.ignore_dc=true -Dcassandra.ignore_rack=true" |
References:
[1]failed to start dse solr node
===
[erq]
vim可以通过scp来编辑远程文件,大约是这个样子:
1 | $ vim scp://user@host/path/to/file |
很神奇的样子。此功能依赖于netrw.vim,vim已经在发行中集成。
psql 提供变量替换特性,类似于shell的变量。
psql的变量就是简单的名字/值对,名字只能有字母、数字和下划线组成。
使用\set命令来设置变量:
1 | => \\set foo bar |
这样设置了变量foo,其值为bar。这样来显示变量的值:
1 | => \\echo :foo |
使用\set只指定变量名,不指定值时,会设置该变量,只不过其值为空。
使用\unset命令来销毁变量:
1 | => \\unset foo |
使用\set命令,不提供任何参数,显示全部的变量。
下面展示的是系统预置的变量:
1 | => \\set |
查看PostgreSQL版本
因此获取postgresql版本就有了另外一种方法:
1 | => \\echo :VERSION |
另一种方法是:
1 | => SELECT VERSION(); |
二者结果是一样的。
===
[erq]