I'd like to know what the ideal Aerospike namespace configuration is for a mini (staging) server on Ubuntu 12.04 with 1 GB ram and 1 GHz CPU
Some requirements:
1. I'd like to persist data permanently on disk (not using it as a cache).
2. I'm only using a single node
3. I don't want a limit on the filesize of my data
Here's my current config snippet I'm using:
namespace default {
replication-factor 1
memory-size 1G
default-ttl 0 # not sure if this is for cache or disk
storage-engine device {
file /opt/aerospike/data/default.dat
filesize 2T
data-in-memory true
}
}
Thanks
Aerospike doesn't cache data-in-memory. If data-in-memory is set to true then all of your data must fit in RAM.
On a single node you will not be affected by the replication-factor parameter.
Aerospike has a limit of 2 TiB per file, but you can create multiple files of this size and Aerospike will distribute data across them. When going through a filesystem, having multiple files often helps. Also if you are going to use a filesystem then you may wan to look into disabling atime when mounting the disks.
default-ttl is how long the server will keep a record after it is written by default (can be overridden by your application). A default-ttl of 0 mean to never expire or evict data.
Example config with multiple files:
namespace default {
replication-factor 1
memory-size 1G
default-ttl 0 # (This applies to the primary index)
storage-engine device {
file /opt/aerospike/data/file0.dat
file /opt/aerospike/data/file1.dat
file /opt/aerospike/data/file2.dat
file /opt/aerospike/data/file3.dat
file /opt/aerospike/data/file4.dat
file /opt/aerospike/data/file5.dat
filesize 2T
data-in-memory true
}
}
Related
I run a server node in java code package xxx.jar, but occur exception like this:
Caused by: java.nio.file.FileSystemException: /home/ranger/EIIP/tools/work/db/ServerNode/cache-TOFTableCache/part-942.bin: Too many open files
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newAsynchronousFileChannel(UnixFileSystemProvider.java:196)
at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:248)
at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:301)
at org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIO.<init>(AsyncFileIO.java:66)
at org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory.create(AsyncFileIOFactory.java:44)
at org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore.init(FilePageStore.java:523)
... 31 more
but only occured in ubuntu VM at windows, and no this exception when run at pure ubuntu system, I tried the following methods, but still the same problem:
vim /etc/security/limits.conf
root soft nofile 10240
root hard nofile 20480
vim /etc/sysctl.conf
fs.inotify.max_user_watches=524288
ulimit -n 4096
this is my code:
IgniteConfiguration igniteCfg = new IgniteConfiguration();
igniteCfg.setConsistentId("ServerNode"); //Set Consistent ID
// Ignite Persistence
DataStorageConfiguration storageCfg = new DataStorageConfiguration();
DataRegionConfiguration regionCfg = new DataRegionConfiguration();
regionCfg.setName("TableCache_Region");
regionCfg.setInitialSize(100L * 1024 * 1024);
regionCfg.setMaxSize(8L * 1024 * 1024 * 1024);
regionCfg.setPersistenceEnabled(true);
storageCfg.setDataRegionConfigurations(regionCfg);
storageCfg.setPageSize(4096); // Changing the page size to 4 KB.
storageCfg.setWriteThrottlingEnabled(true); // Enabling the writes throttling.
igniteCfg.setDataStorageConfiguration(storageCfg);
igniteCfg.setWorkDirectory(System.getProperty("user.dir") + "/work"); // System.getProperty("java.class.path")
Ignite ignite = Ignition.start(igniteCfg);
ignite.cluster().baselineAutoAdjustEnabled(false);
// Activate a cluster automatically once all the nodes of the baseline topology have joined after a cluster restart.
ignite.cluster().active(true);
// Manually setting Baseline Topology
Collection<ClusterNode> nodes = ignite.cluster().forServers().nodes();
// Set all server nodes to baseline topology
ignite.cluster().setBaselineTopology(nodes);
Any idea how to resolve this issue?
Thanks.
enter image description here
As I know to persists the ulimits values across reboots you should set it in the configuration file:
/etc/security/limits.conf
It contains "soft" and "hard" options. Hard options for root, soft for others.
Using ulimit command you can overwrite the "soft" values for current user and session. Probably your limits weren't stored or you set "soft" options but start the GridGain using sudo command and your "hard" options were incorrect.
Could you please double-check and provide the next information:
1)What operation system is used by you?
2)Do you have /etc/security/limits.conf file in your environment?
3)Do you have correct values for user that will start the Ignite. In case if you started it under root then check the "hard" options
However, I suggest to set the following options there:
ignite soft nofile 65536
ignite hard nofile 65536
ignite soft nproc 65536
ignite hard nproc 65536
Where ignite is the username that was used for Ignite starting.
I want to run Aerospike server in single-server mode.
Now I have this configuration:
service {
paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
service-threads 4
transaction-queues 4
transaction-threads-per-queue 4
proto-fd-max 15000
}
logging {
console {
context any info
}
}
network {
service {
address 127.0.0.1
port 3000
}
heartbeat {
mode multicast
multicast-group 239.1.99.222
port 9918
# To use unicast-mesh heartbeats, remove the 3 lines above, and see
# aerospike_mesh.conf for alternative.
interval 150
timeout 10
}
fabric {
port 3001
}
info {
port 3003
}
}
namespace test {
replication-factor 1
memory-size 20M
default-ttl 1d # 30 days, use 0 to never expire/evict.
storage-engine memory
}
And when I try to start server I got error in the log:
"Unable to find any suitable network device for node ID"
I don't want server to be available to internet.
How to achieve this and fix the issue?
The Node ID is generated using the MAC id of the interface on the host.
https://github.com/aerospike/aerospike-server/blob/master/cf/src/socket.c#L2470
If you dont have any of the default interface names that aerospike is aware of, then you might get this error.
To fix this problem, you can specify your interface name.
http://www.aerospike.com/docs/operations/troubleshoot/startup#problem-with-network-interface
To avoid exposing your aerospike node on internet, you can bind it only to localhost or to a private interface only or use other network tools/devices to avoid exposing the server port such as firewall or ACL. Best way to avoid exposing aerospike on internet is to ensure that the server hosting aerospike is not exposed to internet. If that is not doable then restrict your aerospike port access to your aerospike clients IP only using firewall. Also, you can use database credentials available in enterprise edition.
http://www.aerospike.com/docs/guide/security.html
We have a namespace configured to store data in memory only with couple of minutes default ttl. After starting putting some data into it, when expiration kicks in, we're getting these messages in the log (a lot, for ~30% of expired records):
WARNING (namespace): (namespace.c::762) set_id 1 - n_bytes_memory went negative!
I have simple client app with server config that can reproduce this: https://github.com/akkomar/aerospike-test (it's based on docker and is very easy to start)
Any advice what might be the reason?
Edit:
I checked this on versions 3.6.4, 3.7.0.1 and 3.7.4
Configuration file used for testing (from https://github.com/akkomar/aerospike-test/blob/master/etc/aerospike.conf):
service {
user root
group root
paxos-single-replica-limit 1
pidfile /var/run/aerospike/asd.pid
service-threads 4
transaction-queues 4
transaction-threads-per-queue 4
proto-fd-max 1024
}
logging {
file /var/log/aerospike/aerospike.log {
context any info
}
console {
context any info
context namespace detail
}
}
network {
service {
address any
port 3000
}
heartbeat {
mode mesh
port 3002
mesh-port 3002
interval 150
timeout 10
}
fabric {
port 3001
}
info {
port 3003
}
}
namespace test_ns {
replication-factor 2
memory-size 1G
default-ttl 10S
storage-engine memory
}
Edit2:
It seems that it's happening only if I update records via UDF. The simplest one that reproduces this:
local VAL_KEY = "v"
function add_data(rec, val_to_add, ttl_to_set)
if aerospike:exists(rec) then
rec[VAL_KEY] = val_to_add
aerospike:update(rec)
else
rec[VAL_KEY] = val_to_add
aerospike:create(rec)
end
end
When I execute the same operation via Java API - everything seems to work fine (example github repo mentioned earlier is updated with Java API example)
The meaning of the error message is that the space we have accounted for the set in memory went to a negative number which should not be possible.
This has been logged in our internal bug tracking system for resolution in future releases
It turned out it was a bug in Aerospike.
It's fixed in version 3.7.4.1 (detailed explanation in https://discuss.aerospike.com/t/problem-with-expiring-records-in-memory-only-namespace-n-bytes-memory-went-negative/2560/6)
I have a debian VM deployed at BlueMix, and I want to increase the size of the hard drive mounting a BlockStorage Device.
I followed the instructions on the new Beta BlockStorage Service and created a volume, and then attached it to the VM as a new device, but seems that although the volume is attached to the VM; is not automatically mounted.
I tryed several ways to mount it, but I did not find it the correct way. In fact, I even tryed to clone the line that came on the fstab refering to the root device mounted (I suspected that the additional volume should be similar) but it did not work (even broke the reboot of my machine)... So.. Can someone please advice me how to mount the BlockStorage Bluemix Service on the VM Machine ?
THks!
By attaching a volume you've essentially done the equivalent of plugging a raw, physical hard disk into your system. Before you can mount it you'll have to format it with a filesystem known by your OS.
After attaching the device you should be able to see the raw block device, for example with the lsblk command:
[mysys]# lsblk
sr0 11:0 1 416K 0 rom
vda 252:0 0 20G 0 disk
--vda1 252:1 0 20G 0 part /
vdb 252:16 0 25G 0 disk
Typically vda is your root device, so in this example the additional device is vdb with 25GB.
Now you can create a filesystem with the mkfs command, for example:
[mysys]# mkfs.ext4 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1638400 inodes, 6553600 blocks
...
mkfs supports different filesystems, so you might want to check the man pages on the system you're using (man mkfs).
Now all that's left is to create a mount point and mount the new filesystem:
[mysys]# mkdir /mnt/test
[mysys]# mount /dev/vdb /mnt/test
The additional space is now available:
[mysys]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 946M 18G 5% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/vdb 25G 172M 24G 1% /mnt/test
I have a running Aerospike server with about 36,000 records in a single set. All I'm storing is a few bins for the set. I have configured my aerospike.conf file to persist data on disk as well:
namespace default {
replication-factor 2
memory-size 4G
default-ttl 0
storage-engine device {
file /opt/aerospike/data/default.dat
filesize 2T
data-in-memory true
}
}
The problem I'm having is that my /opt/aerospike/data/default.dat file is listed in my system as about 2TB:
/opt/aerospike/data# ls -lh
total 10M
-rw------- 1 root root 2.0T Jun 5 19:01 default.dat
My questions are:
Why does this .dat file have to be 2TB when the data I'm using in Aerospike is minimal for now?
My hard drive limit is 78GB, so why isn't my Ubuntu system not giving me out of drive space errors?
System disk space looks fine:
df -h --total
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 79G 4.2G 72G 6% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.0G 8.0K 2.0G 1% /dev
tmpfs 395M 424K 395M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user
total 83G 4.2G 76G 6% -
Anyone have any ideas?
Well,
Aerospike uses sparse file (or kind of) for storing its file storage.
So when you specified the filesize 2T in namespace config, Aerospike will create a sparse file of size 2TB that you are seeing.
http://en.wikipedia.org/wiki/Sparse_file
So, its just a file with some metadata and not real 2TB data. Once the file content has actually filled your disk, you will see the usual disk full errors on both your system as well as in Aerospike.