sudo systemctl start ceph-radosgw@rgw.`hostname -s`
sudo systemctl enable ceph-radosgw@rgw.`hostname -s`
systemctl reset-failed ceph-mgr@{{ ansible_hostname }}"
Written with StackEdit.
sudo systemctl start ceph-radosgw@rgw.`hostname -s`
sudo systemctl enable ceph-radosgw@rgw.`hostname -s`
systemctl reset-failed ceph-mgr@{{ ansible_hostname }}"
Written with StackEdit.
RGW raw object store has following structure:
// rgw/rgw_rados.h
struct RGWRawObjState {
rgw_raw_obj obj;
bool has_attrs{false};
bool exists{false};
uint64_t size{0};
ceph::real_time mtime;
uint64_t epoch;
bufferlist obj_tag;
bool has_data{false};
bufferlist data;
bool prefetch_data{false};
uint64_t pg_ver{0};
/* important! don't forget to update copy constructor */
RGWObjVersionTracker objv_tracker;
map<string, bufferlist> attrset;
RGWRawObjState() {}
Written with StackEdit.
Why PGs?
PGs enable a balanced distribution of objects. Without PGs, there are two ways to distribute objects:
a. Mirroring on other OSDs
b. Keep a copy of object on all the nodes in the cluster (declustering)
PGs provide a way to replicate a set of objects in a fault-tolerant manner.
Written with StackEdit.
RGW maintains a manifest of each object. The class RGWObjManifest
implements the details with object head, tail placement.
Manifest is written as XATTRs along with RGWRados::Object::Write::_do_write_meta( )
.
/**
* Write/overwrite an object to the bucket storage.
* bucket: the bucket to store the object in
* obj: the object name/key
* data: the object contents/value
* size: the amount of data to write (data must be this long)
* accounted_size: original size of data before compression, encryption
* mtime: if non-NULL, writes the given mtime to the bucket storage
* attrs: all the given attrs are written to bucket storage for the given object
* exclusive: create object exclusively
* Returns: 0 on success, -ERR# otherwise.
*/
Written with StackEdit.
Written with StackEdit.
Written with StackEdit.
$ ls -l|more
if write from ls
is too much to handle by more
, the write waits till read drains it.lseek( )
does not work on unidirectional pipes.FD | filename |
---|---|
10 | /tmp/xx |
After calling dup(), we get a new entry with a new FD.
FD | Filename |
---|---|
10 | /tmp/xx |
11 | /tmp/xx |
Both the entries map to same slot in the global file table. It is equivalent to a file softlink. Now, we can close the fd 10 and use fd 11 to continue ops or keep both of them open.
dup()
returns the lowest available FD in the process. To exploit this fact, we can close standard FDs (0,1,2) and the next call to dup() would return these FDs.
int fd[2];
int p = pipe(fd);
close(1); // frees up fd 0
dup(fd[1]);
// dup will return the lowest available FD, one for fd[1].
FD | File name |
---|---|
10 | /tmp/xx |
1 | /tmp/xx |
Now any write that was supposed to go to FD 1, would go to file /tmp/xx
Written with StackEdit.
void handler()
{
signal(SIGINT, handler);
}
sleep()
call. Sleep call is just waiting infinitely for a signal. To create such wait, pause()
function is used.Written with StackEdit.
setgrp()
.nohup ./a,out &
$chmod u+s file
Written with StackEdit.
printf()
used before exec might not work because its buffers were not flushed.
fflush()
.Written with StackEdit.
wait(int *p)
* p will have the return code of the child. So we can find
if process was terminated normally or not.
The following code writes the string twice to the file. Why?
int main()
{
char *p = "hello world";
FILE *fp;
fp = fopen("test", "w");
fwrite(p, sizeof(p), 1, fp);
fork();
fork()
also copies environment variables of the parent to the child. Type $set
to access env vars.Written with StackEdit.
I started getting this error after trying to install macvim as follows:
brew install macvim --override-system-vim
The error string is as following:
$ vi linkedlist.cc
dyld: Library not loaded: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/Python
Referenced from: /usr/local/bin/vim
Reason: image not found
Abort trap: 6
I checked shared libs for vim using otool
.
$ otool -L /usr/local/bin/vim
/usr/local/bin/vim:
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
(compatibility version 45.0.0, current version 1561.40.112)
/usr/local/opt/lua/lib/liblua.5.3.dylib
(compatibility version 5.3.0, current version 5.3.4)
/usr/local/opt/perl/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE/libperl.dylib
(compatibility version 5.26.0, current version 5.26.1)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/Python
(compatibility version 3.6.0, current version 3.6.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 1452.23.0)
/usr/local/opt/ruby/lib/libruby.2.5.dylib (compatibility version 2.5.0, current version 2.5.1)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
(compatibility version 1.0.0, current version 822.31.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
(compatibility version 300.0.0, current version 1452.23.0)
It appears that many shared libs versions are updated incorrectly.
To solve the problem, I tried to upgrade packages.
$ brew update
Already up-to-date.
$ brew upgrade
It started working after doing upgrades.
Written with StackEdit.
2018-07-18 08:58:12.794311 7f4aa0925700 -1
osd.127 206901 heartbeat_check:
no reply from osd.55 since
back 2018-07-18 08:45:13.647493
front 2018-07-18 08:45:13.647493
(cutoff 2018-07-18 08:57:12.794247)
2018-07-18 08:58:12.794315 7f4aa0925700 -1 osd.127 206901
heartbeat_check: no reply from osd.57 since back
2018-07-18 08:45:42.452510 front 2018-07-18
08:45:42.452510 (cutoff 2018-07-18 08:57:12.794247)
2018-07-18 08:58:12.794321 7f4aa0925700 -1 osd.127 206901
heartbeat_check: no reply from osd.82 since back
2018-07-18 08:45:13.647493 front 2018-07-18
08:45:13.647493
(cutoff 2018-07-18 08:57:12.794247)
2018-07-18 08:56:52.668789 7f4886d7b700
0 -- 10.33.49.153:6816/505502 >> 10.33.213.157:6801/2707
pipe(0x7f4a4f39d000 sd=26 :13251
s=1 pgs=233 cs=2 l=0 c=0x7f4a4f1b8980).connect
claims to be 10.33.213.157:6801/1003787 not
10.33.213.157:6801/2707 - wrong node!
Set norebalance, norecover, nobackfill
Adding swap memory to OSDs
Tuning heartbeat interval
Tuning OSD map sync and setting noout, nodown to let OSDs sync their maps.
$ sudo ceph daemon osd.148 status
{
"cluster_fsid": "621d76ce-a208-42d6-a15b-154fcb09xcrt",
"osd_fsid": "09650e4c-723e-45e0-b2ef-5b6d11a6da03",
"whoami": 148,
"state": "booting",
"oldest_map": 156518,
"newest_map": 221059,
"num_pgs": 1295
}
Written with StackEdit.