{"id":31541,"date":"2016-01-16T19:18:13","date_gmt":"2016-01-16T13:48:13","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=31541"},"modified":"2016-01-19T13:23:46","modified_gmt":"2016-01-19T07:53:46","slug":"cassandra-authentication-and-create-user","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/cassandra-authentication-and-create-user\/","title":{"rendered":"Cassandra Authentication and Create User"},"content":{"rendered":"<h3 style=\"text-align: justify;\"><em><span style=\"text-decoration: underline;\">Introduction<\/span> :<\/em><\/h3>\n<p style=\"text-align: justify;\">The Apache <a title=\"cassandra consulting\" href=\"http:\/\/www.tothenew.com\/analytics\">Cassandra<\/a> database is the right choice when you need scalability and high availability without compromising performance.\u00a0Not having to distinguish between a Master and a Slave node allows you to add any number of machines to any cluster in any datacenter, without having to worry about what type of machine you need at the moment. Every server accepts requests from any client. There are no single points of failure. There are no network bottlenecks. Every node in the cluster is identical.<\/p>\n<p style=\"text-align: justify;\">By default when we install cassandra on a machine it do not has any username and password authentication. We can directly use cassandra console by just a simple\u00a0command <strong>cqlsh<\/strong>. Therefore this blog post is regarding to enable the authentication in cassandra and to create a user with different access permissions to databases.<\/p>\n<h3 style=\"text-align: justify;\"><em><span style=\"text-decoration: underline;\">Basic Key Points<\/span> :<\/em><\/h3>\n<ol style=\"text-align: justify;\">\n<li><span style=\"color: #ff0000;\"><strong>cassandra.yaml<\/strong><\/span> file location:\n<ul>\n<li class=\"li\"><strong>Cassandra Packaged installs:<\/strong> <span class=\"ph filepath\">\/etc\/cassandra\/conf<\/span><\/li>\n<li class=\"li\"><strong>Cassandra Binary installs (tarball):<\/strong> <span class=\"ph filepath\">&lt;install_location&gt;\/conf<\/span><\/li>\n<li class=\"li\"><strong>DataStax Enterprise Packaged installs:<\/strong> <span class=\"ph filepath\">\/etc\/dse\/cassandra<\/span><\/li>\n<li class=\"li\" style=\"text-align: left;\"><strong>DataStax Enterprise Binary installs (tarball):<\/strong> <span class=\"ph filepath\">&lt;install_location&gt;\/resources\/cassandra\/conf<\/span><\/li>\n<\/ul>\n<\/li>\n<li><strong><span style=\"color: #ff0000;\">OpsCenter :\u00a0<\/span><\/strong><span style=\"color: #ff0000;\"><span style=\"color: #333333;\">A tool to create and manage cassandra clusters.<\/span><\/span><\/li>\n<\/ol>\n<h3 style=\"text-align: justify;\"><span style=\"text-decoration: underline;\"><em><strong>Steps to Enable Authentication<\/strong><\/em><\/span>\u00a0:<\/h3>\n<ol style=\"text-align: justify;\">\n<li>Edit the <strong>cassandra.yaml <\/strong>file in all the servers in cassandra cluster and change the following properties\n<ul>\n<li><strong>authorizer : <span style=\"color: #339966;\">CassandraAuthorizer<\/span><\/strong><\/li>\n<li><strong>authenticator : <span style=\"color: #339966;\">PasswordAuthenticator<\/span><\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Now Restart the cassandra servers as\n<ul>\n<li>If\u00a0Cassandra Packaged installs (installed as a service) then run the\u00a0command \u00a0: \u00a0<strong><span style=\"color: #333333;\">sudo service cassandra restart<\/span><\/strong><\/li>\n<li>If Cassandra binary Installs (installed manually) then run following commands\n<ul>\n<li><strong>ps -eaf | grep cassandra \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0(note the pid of cassandra)<\/strong><\/li>\n<li><strong>kill -9 &lt;pid&gt;<\/strong><\/li>\n<li><strong>&lt;install location&gt;\/bin\/cassandra<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>If you are having OpsCenter installed in machine the you can change the above config properties form Opscenter UI.\n<ul>\n<li>Go to OpsCenter UI in browser as <strong>&lt;serverIp&gt;\/8888<\/strong><\/li>\n<li>On the upper right corner click on <strong>Cluster Actions\u00a0<\/strong>dropdown and then click <strong>configure<\/strong><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-31557 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/01\/c1-1.png\" alt=\"\" width=\"1024\" height=\"637\" \/><\/li>\n<li>Now Configure the above properties from UI as<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-31558 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/01\/5a165125-19a3-4430-b5fc-a8e3ea1e32c0-1.png\" alt=\"\" width=\"1024\" height=\"640\" \/>&nbsp;<\/li>\n<li>Change the properties and click the <b>Save Configuration\u00a0<\/b>at the end of configuration popup.<\/li>\n<li>Now restart the cluster from the same right upper corner dropdown menu by clicking\u00a0<strong><strong>restart.<\/strong><\/strong>&nbsp;<\/li>\n<\/ul>\n<\/li>\n<li>Ahoy You are done.<\/li>\n<li>Now time to access cassandra console by using default username and password.<\/li>\n<li>Run the command :\u00a0<strong>cqlsh &lt;localhost or server Ip&gt; -u cassandra -p cassandra<\/strong><\/li>\n<li>Now You can create user as\n<ul>\n<li><strong>CREATE USER &#8216;user_name&#8217; WITH PASSWORD &#8216;&lt;password&gt;&#8217;;<\/strong><\/li>\n<li><strong>CREATE USER &#8216;user_name&#8217; WITH PASSWORD &#8216;&lt;password&gt;&#8217; SUPERUSER; \u00a0 \u00a0<span style=\"color: #008000;\">&lt;to create super user&gt;<\/span><\/strong><\/li>\n<li>Now you can give the access of individual Keyspaces to specific users as\n<ul>\n<li><strong><span style=\"color: #ff6600;\">GRANT SELECT ON KEYSPACE &lt;keyspace_name&gt; TO &#8216;&lt;user_name&gt;&#8217;;<\/span><\/strong> \u00a0 \u00a0 \u00a0<span style=\"color: #008000;\"><strong>&lt;gives only read only access to user&gt;<\/strong><\/span><\/li>\n<li><strong><span style=\"color: #ff6600;\">GRANT ALL\u00a0ON KEYSPACE &lt;keyspace_name&gt; TO &#8216;&lt;user_name&gt;&#8217;; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span style=\"color: #008000;\"><strong>&lt;gives all\u00a0access to user&gt;<\/strong><\/span><\/span><\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3 style=\"text-align: justify;\"><span style=\"text-decoration: underline;\"><strong>Conclusion<\/strong><\/span><strong> :<\/strong><\/h3>\n<p style=\"text-align: justify;\">So this is the way to enable the authentication is cassandra and to create users with different permissions. Hope you all will like the post. I will be back soon with some new topic, till then\u00a0stay happy and keep exploring \u00a0 \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction : The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance.\u00a0Not having to distinguish between a Master and a Slave node allows you to add any number of machines to any cluster in any datacenter, without having to worry about what type of machine you need [&hellip;]<\/p>\n","protected":false},"author":591,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":91},"categories":[1395],"tags":[501,2982,2983],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/31541"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/591"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=31541"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/31541\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=31541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=31541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=31541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}